Commit d9286b5345c0d936762eb6c7c21192bd4aa10bed

Authored by superlollipop
Committed by GitHub
1 parent 8d218ec8

修复表格设置固定列,事件回调数据错误 (#2605)

* fix: 修复异步加载表格列时,表格设置显示列为空

* fix: 修复表格设置固定按钮回调事件,未过滤当前选择的列导致回调数据错误
src/components/Table/src/components/settings/ColumnSetting.vue
@@ -347,7 +347,9 @@ @@ -347,7 +347,9 @@
347 function handleColumnFixed(item: BasicColumn, fixed?: 'left' | 'right') { 347 function handleColumnFixed(item: BasicColumn, fixed?: 'left' | 'right') {
348 if (!state.checkedList.includes(item.dataIndex as string)) return; 348 if (!state.checkedList.includes(item.dataIndex as string)) return;
349 349
350 - const columns = getColumns() as BasicColumn[]; 350 + const columns = getColumns().filter((c: BasicColumn) =>
  351 + state.checkedList.includes(c.dataIndex as string),
  352 + ) as BasicColumn[];
351 const isFixed = item.fixed === fixed ? false : fixed; 353 const isFixed = item.fixed === fixed ? false : fixed;
352 const index = columns.findIndex((col) => col.dataIndex === item.dataIndex); 354 const index = columns.findIndex((col) => col.dataIndex === item.dataIndex);
353 if (index !== -1) { 355 if (index !== -1) {