Vuejs beobachten nach verschachtelten Daten
watch: {
item: {
handler(val){
// do stuff
},
deep: true
}
}
MrMalfunction
watch: {
item: {
handler(val){
// do stuff
},
deep: true
}
}
...
watch:{
'item.someOtherProp'(newVal){
//to work with changes in "myArray"
},
'item.prop'(newVal){
//to work with changes in prop
}
}
var vm = new Vue({
el: '#app',
computed: {
foo() {
return this.item.foo;
}
},
watch: {
foo() {
console.log('Foo Changed!');
}
},
data: {
item: {
foo: 'foo'
}
}
})