Commit c3096e26ff24c8afd9555e676c898030664846d7
1 parent
1d7608ee
fix(table): fix table check column configuration failure close #391
Showing
3 changed files
with
6 additions
and
3 deletions
CHANGELOG.zh_CN.md
src/components/Table/src/components/settings/ColumnSetting.vue
@@ -113,6 +113,7 @@ | @@ -113,6 +113,7 @@ | ||
113 | 113 | ||
114 | import { isNullAndUnDef } from '/@/utils/is'; | 114 | import { isNullAndUnDef } from '/@/utils/is'; |
115 | import { getPopupContainer } from '/@/utils'; | 115 | import { getPopupContainer } from '/@/utils'; |
116 | + import { omit } from 'lodash-es'; | ||
116 | 117 | ||
117 | import type { BasicColumn } from '../../types/table'; | 118 | import type { BasicColumn } from '../../types/table'; |
118 | 119 | ||
@@ -147,7 +148,7 @@ | @@ -147,7 +148,7 @@ | ||
147 | const { t } = useI18n(); | 148 | const { t } = useI18n(); |
148 | const table = useTableContext(); | 149 | const table = useTableContext(); |
149 | 150 | ||
150 | - const defaultRowSelection = table.getRowSelection(); | 151 | + const defaultRowSelection = omit(table.getRowSelection(), 'selectedRowKeys'); |
151 | let inited = false; | 152 | let inited = false; |
152 | 153 | ||
153 | const cachePlainOptions = ref<Options[]>([]); | 154 | const cachePlainOptions = ref<Options[]>([]); |
src/components/Table/src/hooks/useRowSelection.ts
@@ -16,10 +16,11 @@ export function useRowSelection( | @@ -16,10 +16,11 @@ export function useRowSelection( | ||
16 | if (!rowSelection) { | 16 | if (!rowSelection) { |
17 | return null; | 17 | return null; |
18 | } | 18 | } |
19 | + | ||
19 | return { | 20 | return { |
20 | selectedRowKeys: unref(selectedRowKeysRef), | 21 | selectedRowKeys: unref(selectedRowKeysRef), |
21 | hideDefaultSelections: false, | 22 | hideDefaultSelections: false, |
22 | - onChange: (selectedRowKeys: string[], selectedRows: any[]) => { | 23 | + onChange: (selectedRowKeys: string[], selectedRows: Recordable[]) => { |
23 | selectedRowKeysRef.value = selectedRowKeys; | 24 | selectedRowKeysRef.value = selectedRowKeys; |
24 | selectedRowRef.value = selectedRows; | 25 | selectedRowRef.value = selectedRows; |
25 | emit('selection-change', { | 26 | emit('selection-change', { |
@@ -27,7 +28,7 @@ export function useRowSelection( | @@ -27,7 +28,7 @@ export function useRowSelection( | ||
27 | rows: selectedRows, | 28 | rows: selectedRows, |
28 | }); | 29 | }); |
29 | }, | 30 | }, |
30 | - ...rowSelection, | 31 | + ...(rowSelection === undefined ? {} : rowSelection), |
31 | }; | 32 | }; |
32 | }); | 33 | }); |
33 | 34 |