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

修复去掉checkList 后,移动配置中的table顺序后,调用tabel.setColum() 时触发 init() ,导致checkList 被重置bug
This commit is contained in:
Jiang 2021-12-12 22:09:14 +08:00 committed by GitHub
parent ab62739fd1
commit 23b5538eae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,6 +124,7 @@
interface State { interface State {
checkAll: boolean; checkAll: boolean;
isInit: boolean;
checkedList: string[]; checkedList: string[];
defaultCheckList: string[]; defaultCheckList: string[];
} }
@ -180,7 +181,7 @@
watchEffect(() => { watchEffect(() => {
const columns = table.getColumns(); const columns = table.getColumns();
if (columns.length) { if (columns.length && !state.isInit) {
init(); init();
} }
}); });
@ -233,6 +234,7 @@
} }
}); });
} }
state.isInit = true;
state.checkedList = checkList; state.checkedList = checkList;
} }