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() {
this.columnsSetting = this.columns.map((value) => ({
...value,
checked: true
}))
this.originColumns = [...this.columnsSetting]
this.columnsSetting = this.columns.map((value) => {
if (value.checked == undefined) {
return {
...value,
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: {
reset() {
this.originColumns = [...this.columnsSetting]
this.columnsSetting = this.originColumns.map((value) => ({ ...value }))
this.indeterminate = false
this.checkAll = true
const checkedList = this.columnsSetting.filter((value) => value.checked)
this.checkAll = checkedList.length === this.columnsSetting.length
this.emitColumnChange()
},
onChange() {