export default { data() { return { a: { b: 1, c: 2 } } }, watch() { a: { handler(newVal, oldVal) { console.log('監聽a整個對象的變化'); }, deep: true } } }
export default { data() { return { a: { b: 1, c: 2 } } }, watch() { bChange() { console.log('監聽a對象中b屬性的變化'); } }, computed: { bChange() { return this.a.b; } } }