mirror of https://gitee.com/xiaonuobase/snowy
BUG:CoolumnSetting的重置功能不可用
parent
4b2d9e515d
commit
d889c4dc0f
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue