listening method:
watch
: {
editArr: {
handler: function(val, old) {
console.log(val)
console.log(old)
val.forEach((item,index)=> {
// console.log(val[index]["value"])
// console.log(old[index]["value"])
if(val[index]["value"] !== old[index]["value"]) {
console.log("bianhuala")
}
})
},
deep: true
}
},
editArr:
build array method:
obj["name"]="xxx"
obj["value"]="xxx"
editArr.push(obj)
results print out that val
and old
are both new values after change, while old
cannot be monitored?