BUG:CoolumnSetting的重置功能不可用

pull/112/MERGE
yzp 2023-04-11 13:52:33 +08:00 committed by 小诺
parent 4b2d9e515d
commit d889c4dc0f
1 changed files with 16 additions and 7 deletions

View File

@ -45,17 +45,26 @@
} }
}, },
mounted() { mounted() {
this.columnsSetting = this.columns.map((value) => ({ this.columnsSetting = this.columns.map((value) => {
...value, if (value.checked == undefined) {
checked: true return {
})) ...value,
this.originColumns = [...this.columnsSetting] checked: true
}
} else return value
})
// originColumns
this.originColumns = this.columnsSetting.map((value) => ({ ...value }))
//
const notCheckedList = this.columnsSetting.filter((value) => !value.checked)
if (notCheckedList.length) this.checkAll = false
}, },
methods: { methods: {
reset() { reset() {
this.originColumns = [...this.columnsSetting] this.columnsSetting = this.originColumns.map((value) => ({ ...value }))
this.indeterminate = false this.indeterminate = false
this.checkAll = true const checkedList = this.columnsSetting.filter((value) => value.checked)
this.checkAll = checkedList.length === this.columnsSetting.length
this.emitColumnChange() this.emitColumnChange()
}, },
onChange() { onChange() {