1export default {
2 name: 'ColorChange',
3 props: {
4 colors: {
5 type: Array,
6 required: true,
7 },
8 },
9 watch: {
10 colors: {
11 // This will let Vue know to look inside the array
12 deep: true,
13
14 // We have to move our method to a handler field
15 handler(value) {
16 console.log('The list of colors has changed!', value);
17 }
18 }
19 }
20}
1...
2watch:{
3 'item.someOtherProp'(newVal){
4 //to work with changes in "myArray"
5 },
6 'item.prop'(newVal){
7 //to work with changes in prop
8 }
9}