Commit 23b5538eae8c9737b9a4f1ae399cdce393dbb994
Committed by
GitHub
1 parent
ab62739f
修复 init 运行时机不正确 (#1452)
修复去掉checkList 后,移动配置中的table顺序后,调用tabel.setColum() 时触发 init() ,导致checkList 被重置bug
Showing
1 changed file
with
3 additions
and
1 deletions
src/components/Table/src/components/settings/ColumnSetting.vue
@@ -124,6 +124,7 @@ | @@ -124,6 +124,7 @@ | ||
124 | 124 | ||
125 | interface State { | 125 | interface State { |
126 | checkAll: boolean; | 126 | checkAll: boolean; |
127 | + isInit: boolean; | ||
127 | checkedList: string[]; | 128 | checkedList: string[]; |
128 | defaultCheckList: string[]; | 129 | defaultCheckList: string[]; |
129 | } | 130 | } |
@@ -180,7 +181,7 @@ | @@ -180,7 +181,7 @@ | ||
180 | 181 | ||
181 | watchEffect(() => { | 182 | watchEffect(() => { |
182 | const columns = table.getColumns(); | 183 | const columns = table.getColumns(); |
183 | - if (columns.length) { | 184 | + if (columns.length && !state.isInit) { |
184 | init(); | 185 | init(); |
185 | } | 186 | } |
186 | }); | 187 | }); |
@@ -233,6 +234,7 @@ | @@ -233,6 +234,7 @@ | ||
233 | } | 234 | } |
234 | }); | 235 | }); |
235 | } | 236 | } |
237 | + state.isInit = true; | ||
236 | state.checkedList = checkList; | 238 | state.checkedList = checkList; |
237 | } | 239 | } |
238 | 240 |