主题
watchDeep
用于监视 {deep: true} 值的快捷方式
🌐 Shorthand for watching value with {deep: true}
用法
🌐 Usage
类似于 watch,但是有 { deep: true }
🌐 Similar to watch, but with { deep: true }
ts
import { watchDeep } from '@vueuse/core'
const nestedObject = ref({ foo: { bar: { deep: 5 } } })
watchDeep(nestedObject, (updated) => {
console.log(updated)
})
onMounted(() => {
nestedObject.value.foo.bar.deep = 10
})