Skip to content

reactiveComputed

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

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

This function uses Proxy

It is NOT supported by IE 11 or below.

用法

¥Usage

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

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

state.bar // 'baz'

类型声明

typescript
/**
 * Computed reactive object.
 */
export declare function reactiveComputed<T extends object>(
  fn: () => T,
): UnwrapNestedRefs<T>

源代码

源代码文档

变更日志

No recent changes

VueUse 中文网 - 粤ICP备13048890号