Commit 23b5538eae8c9737b9a4f1ae399cdce393dbb994

Authored by Jiang
Committed by GitHub
1 parent ab62739f

修复 init 运行时机不正确 (#1452)

修复去掉checkList 后,移动配置中的table顺序后,调用tabel.setColum() 时触发 init() ,导致checkList 被重置bug
src/components/Table/src/components/settings/ColumnSetting.vue
... ... @@ -124,6 +124,7 @@
124 124  
125 125 interface State {
126 126 checkAll: boolean;
  127 + isInit: boolean;
127 128 checkedList: string[];
128 129 defaultCheckList: string[];
129 130 }
... ... @@ -180,7 +181,7 @@
180 181  
181 182 watchEffect(() => {
182 183 const columns = table.getColumns();
183   - if (columns.length) {
  184 + if (columns.length && !state.isInit) {
184 185 init();
185 186 }
186 187 });
... ... @@ -233,6 +234,7 @@
233 234 }
234 235 });
235 236 }
  237 + state.isInit = true;
236 238 state.checkedList = checkList;
237 239 }
238 240  
... ...