diff --git a/packages/hooks/src/use-table.ts b/packages/hooks/src/use-table.ts index f861009e..46bcf520 100644 --- a/packages/hooks/src/use-table.ts +++ b/packages/hooks/src/use-table.ts @@ -1,5 +1,5 @@ import { computed, reactive, ref } from 'vue'; -import type { Ref } from 'vue'; +import type { Ref, VNodeChild } from 'vue'; import { jsonClone } from '@sa/utils'; import useBoolean from './use-boolean'; import useLoading from './use-loading'; @@ -8,9 +8,11 @@ export type MaybePromise = T | Promise; export type ApiFn = (args: any) => Promise; +export type TableColumnCheckTitle = string | ((...args: any) => VNodeChild); + export type TableColumnCheck = { key: string; - title: string; + title: TableColumnCheckTitle; checked: boolean; }; diff --git a/src/components/advanced/table-column-setting.vue b/src/components/advanced/table-column-setting.vue index d1e6dca4..014a51ae 100644 --- a/src/components/advanced/table-column-setting.vue +++ b/src/components/advanced/table-column-setting.vue @@ -25,7 +25,10 @@ const columns = defineModel('columns', {
- {{ item.title }} + +
diff --git a/src/hooks/common/table.ts b/src/hooks/common/table.ts index 9bb8f76b..5484bf36 100644 --- a/src/hooks/common/table.ts +++ b/src/hooks/common/table.ts @@ -64,7 +64,7 @@ export function useTable(config: NaiveUI.NaiveTabl if (isTableColumnHasKey(column)) { checks.push({ key: column.key as string, - title: column.title as string, + title: column.title!, checked: true }); } else if (column.type === 'selection') {