From c3096e26ff24c8afd9555e676c898030664846d7 Mon Sep 17 00:00:00 2001 From: Vben <anncwb@126.com> Date: 星期六, 20 三月 2021 21:45:43 +0800 Subject: [PATCH] fix(table): fix table check column configuration failure close #391 --- CHANGELOG.zh_CN.md | 1 + src/components/Table/src/components/settings/ColumnSetting.vue | 3 ++- src/components/Table/src/hooks/useRowSelection.ts | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 71561d2..e85fb3f 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -17,6 +17,7 @@ - 淇 Modal 缁勪欢 loadingTip 閰嶇疆涓嶇敓鏁� - 淇鍚庡彴鏉冮檺鎸囦护涓嶇敓鏁� - 纭繚 progress 杩涘害鏉℃纭叧闂� +- 淇琛ㄦ牸鍕鹃�夊垪閰嶇疆澶辨晥闂 ## 2.1.0 (2021-03-15) diff --git a/src/components/Table/src/components/settings/ColumnSetting.vue b/src/components/Table/src/components/settings/ColumnSetting.vue index 7292881..b569065 100644 --- a/src/components/Table/src/components/settings/ColumnSetting.vue +++ b/src/components/Table/src/components/settings/ColumnSetting.vue @@ -113,6 +113,7 @@ import { isNullAndUnDef } from '/@/utils/is'; import { getPopupContainer } from '/@/utils'; + import { omit } from 'lodash-es'; import type { BasicColumn } from '../../types/table'; @@ -147,7 +148,7 @@ const { t } = useI18n(); const table = useTableContext(); - const defaultRowSelection = table.getRowSelection(); + const defaultRowSelection = omit(table.getRowSelection(), 'selectedRowKeys'); let inited = false; const cachePlainOptions = ref<Options[]>([]); diff --git a/src/components/Table/src/hooks/useRowSelection.ts b/src/components/Table/src/hooks/useRowSelection.ts index 45c46e3..436b991 100644 --- a/src/components/Table/src/hooks/useRowSelection.ts +++ b/src/components/Table/src/hooks/useRowSelection.ts @@ -16,10 +16,11 @@ if (!rowSelection) { return null; } + return { selectedRowKeys: unref(selectedRowKeysRef), hideDefaultSelections: false, - onChange: (selectedRowKeys: string[], selectedRows: any[]) => { + onChange: (selectedRowKeys: string[], selectedRows: Recordable[]) => { selectedRowKeysRef.value = selectedRowKeys; selectedRowRef.value = selectedRows; emit('selection-change', { @@ -27,7 +28,7 @@ rows: selectedRows, }); }, - ...rowSelection, + ...(rowSelection === undefined ? {} : rowSelection), }; }); -- Gitblit v1.8.0