监听对象类型
watch(numObj, (newValue, oldValue) => {
console.log("numObj变化了", newValue, oldValue);
});
监听对象中的一个基本类型属性
watch(
() => numObj.a,
(newValue, oldValue) => {
console.log("numObj变化了", newValue, oldValue);
}
);
监听对象中的一些基本类型属性
watch([() => numObj.a, () => numObj.b], (newValue, oldValue) => {
console.log("numObj变化了", newValue, oldValue);
});
监听对象中的对象类型属性
watch(
numObj.c,
(newValue, oldValue) => {
console.log("numObj.c变化了", newValue, oldValue);
}
);