watchDeep

watchDeep

{deep: true} を使用して値を監視するための省略形

使用法

watch と似ていますが、{ deep: true } を使用します

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