fix(table): fix table check column configuration failure close #391

This commit is contained in:
Vben 2021-03-20 21:45:43 +08:00
parent 1d7608ee40
commit c3096e26ff
3 changed files with 6 additions and 3 deletions

View File

@ -17,6 +17,7 @@
- 修复 Modal 组件 loadingTip 配置不生效 - 修复 Modal 组件 loadingTip 配置不生效
- 修复后台权限指令不生效 - 修复后台权限指令不生效
- 确保 progress 进度条正确关闭 - 确保 progress 进度条正确关闭
- 修复表格勾选列配置失效问题
## 2.1.0 (2021-03-15) ## 2.1.0 (2021-03-15)

View File

@ -113,6 +113,7 @@
import { isNullAndUnDef } from '/@/utils/is'; import { isNullAndUnDef } from '/@/utils/is';
import { getPopupContainer } from '/@/utils'; import { getPopupContainer } from '/@/utils';
import { omit } from 'lodash-es';
import type { BasicColumn } from '../../types/table'; import type { BasicColumn } from '../../types/table';
@ -147,7 +148,7 @@
const { t } = useI18n(); const { t } = useI18n();
const table = useTableContext(); const table = useTableContext();
const defaultRowSelection = table.getRowSelection(); const defaultRowSelection = omit(table.getRowSelection(), 'selectedRowKeys');
let inited = false; let inited = false;
const cachePlainOptions = ref<Options[]>([]); const cachePlainOptions = ref<Options[]>([]);

View File

@ -16,10 +16,11 @@ export function useRowSelection(
if (!rowSelection) { if (!rowSelection) {
return null; return null;
} }
return { return {
selectedRowKeys: unref(selectedRowKeysRef), selectedRowKeys: unref(selectedRowKeysRef),
hideDefaultSelections: false, hideDefaultSelections: false,
onChange: (selectedRowKeys: string[], selectedRows: any[]) => { onChange: (selectedRowKeys: string[], selectedRows: Recordable[]) => {
selectedRowKeysRef.value = selectedRowKeys; selectedRowKeysRef.value = selectedRowKeys;
selectedRowRef.value = selectedRows; selectedRowRef.value = selectedRows;
emit('selection-change', { emit('selection-change', {
@ -27,7 +28,7 @@ export function useRowSelection(
rows: selectedRows, rows: selectedRows,
}); });
}, },
...rowSelection, ...(rowSelection === undefined ? {} : rowSelection),
}; };
}); });