From 89dcb39a108ff608b106ba65b0ba350c48d70149 Mon Sep 17 00:00:00 2001 From: zhaocl1997 <674351624@qq.com> Date: Sun, 10 Apr 2022 21:16:49 +0800 Subject: [PATCH] fix: fix table column text display error --- .../UI/Table/src/components/settings/columns.vue | 7 ++++--- src/components/UI/Table/src/hooks/useTableColumns.tsx | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/UI/Table/src/components/settings/columns.vue b/src/components/UI/Table/src/components/settings/columns.vue index b82afabc..960747af 100644 --- a/src/components/UI/Table/src/components/settings/columns.vue +++ b/src/components/UI/Table/src/components/settings/columns.vue @@ -220,9 +220,10 @@ return (item as TableBaseColumn).title } - if (typeof (item as TableBaseColumn).title === 'function') { - // @ts-ignore - return item.title() + // @ts-expect-error + if (typeof item.titleText === 'function') { + // @ts-expect-error + return item.titleText() } return t('app:base:selection') diff --git a/src/components/UI/Table/src/hooks/useTableColumns.tsx b/src/components/UI/Table/src/hooks/useTableColumns.tsx index 7c347f17..4fed0894 100644 --- a/src/components/UI/Table/src/hooks/useTableColumns.tsx +++ b/src/components/UI/Table/src/hooks/useTableColumns.tsx @@ -24,6 +24,8 @@ export const useTableColumns = ( )} ), + // this is used for column settings to display text correctly + titleText: () => getTableTranslated(props, item), } }