deep/src/App.vue
<script>
export default {
data() {
return {
arr: [0, 1, 2],
obj: { name: 'chulsu' },
};
},
watch: {
arr: { handler(newValue, oldValue) {
console.log(`old value : ${oldValue}`);
console.log(`new value : ${newValue}`);
},
deep: true,
},
obj: { handler(newValue, oldValue) {
console.log(`old value : ${JSON.stringify(oldValue)}`);
console.log(`new value : ${JSON.stringify(newValue)}`);
},
deep: true,
},
},
}