level 3
jevonsyear
楼主
watch: {
labelKeys(newVal) {
this.newKeys= newVal
let array = newVal.filter((item) => this.type=== 'select')
this.newKeys= array
this.array[1].label = '完成整改机构数量及完成率'
this.array[4].label = '完成整改问题数量及完成率'
this.array.splice(2, 1)
this.array.splice(4, 1)
console.log(this.array, 'array')
console.log(this.newKeys)
// this.setKeys()
},
我这个watch监听回来的数据,我改了一下,为什么newKeys也被改了啊,并且我发现他影响了父组件的数据,求解惑
2022年07月20日 14点07分
1
labelKeys(newVal) {
this.newKeys= newVal
let array = newVal.filter((item) => this.type=== 'select')
this.newKeys= array
this.array[1].label = '完成整改机构数量及完成率'
this.array[4].label = '完成整改问题数量及完成率'
this.array.splice(2, 1)
this.array.splice(4, 1)
console.log(this.array, 'array')
console.log(this.newKeys)
// this.setKeys()
},
我这个watch监听回来的数据,我改了一下,为什么newKeys也被改了啊,并且我发现他影响了父组件的数据,求解惑