Skip to content

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
})