vue deep watch array element cha
2017-11-30 本文已影响0人
ccphantom
if you want to push to watching array for instance, you can copy this array, then push to this copy, and then assign this copy to your watching array back. this is very simple.
// copy array which you want to watch
let copiedArray = this.originArray.slice(0)
// push to this copy
copiedArray.push("new value");
// assign this copy to your watching array
this.originArray = copiedArray;