watch: { option: { handler(newVal) { console.log(newVal); }, deep: true, immediate: true } },
需要深层watch就需要开启deep属性
开启immediate属性,设定为true,会打印一次初始值;
watch: { option: { handler(newVal) { console.log(newVal); }, deep: true, immediate: true } },
需要深层watch就需要开启deep属性
开启immediate属性,设定为true,会打印一次初始值;