From e97b905ae5481cceed4dbcdb46ae468886db4e9c Mon Sep 17 00:00:00 2001 From: PED Date: Thu, 27 Feb 2025 17:34:29 +0800 Subject: [PATCH 1/2] feat: Support dynamic column titles in table column settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 columns 重 title 属性可以传入渲染函数 --- src/components/advanced/table-column-setting.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/advanced/table-column-setting.vue b/src/components/advanced/table-column-setting.vue index d1e6dca4..bff01b92 100644 --- a/src/components/advanced/table-column-setting.vue +++ b/src/components/advanced/table-column-setting.vue @@ -25,7 +25,12 @@ const columns = defineModel('columns', {
- {{ item.title }} + +
From 28184d5d6a1d2d400c031ffeceed677372d96e5f Mon Sep 17 00:00:00 2001 From: PED Date: Fri, 28 Feb 2025 09:42:10 +0800 Subject: [PATCH 2/2] feat: Update table column type to support Naive UI column title rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 直接使用了 Naive UI column title 的类型 --- packages/hooks/src/use-table.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/hooks/src/use-table.ts b/packages/hooks/src/use-table.ts index f861009e..72ae01cb 100644 --- a/packages/hooks/src/use-table.ts +++ b/packages/hooks/src/use-table.ts @@ -1,5 +1,6 @@ import { computed, reactive, ref } from 'vue'; import type { Ref } from 'vue'; +import type { DataTableBaseColumn } from 'naive-ui'; import { jsonClone } from '@sa/utils'; import useBoolean from './use-boolean'; import useLoading from './use-loading'; @@ -10,7 +11,7 @@ export type ApiFn = (args: any) => Promise; export type TableColumnCheck = { key: string; - title: string; + title: DataTableBaseColumn['title']; checked: boolean; };