Skip to content

reactiveComputed

计算反应式对象。reactiveComputed 返回一个响应式对象,而不是像 computed 那样返回引用。

¥Computed reactive object. Instead of returning a ref that computed does, reactiveComputed returns a reactive object.

用法

¥Usage

ts
import { reactiveComputed } from '@vueuse/core'

const state = reactiveComputed(() => {
  return {
    foo: 'bar',
    bar: 'baz',
  }
})

state.bar // 'baz'