1watch: {
2 colors: {
3 handler(newValue){
4 console.log('colors changed', newValue)
5 }, deep: true
6 }
7}
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}