watcher in vuejs 2 object code example
Example 1: vue watch deep property
watch: {
item: {
handler(val){
// do stuff
},
deep: true
}
}
Example 2: vue change deep element
Vue.set(vm.someObject, 'b', 2) //for objects
Vue.set(vm.items, indexOfItem, newValue) //forarrays