Skip to content

reactiveComputed

Category
Export Size
264 B
Last Changed
6 months ago

响应式计算对象。与 computed 返回 ref 不同,reactiveComputed 返回一个响应式对象。

This function uses Proxy

It is NOT supported by IE 11 or below.

用法

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

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

state.bar // 'baz'

类型声明

typescript
/**
 * 计算响应式对象。
 */
export declare function reactiveComputed<T extends object>(
  fn: () => T,
): UnwrapNestedRefs<T>

Source

SourceDocs

贡献者

Anthony Fu
丶远方
Anthony Fu
三咲智子 Kevin Deng
qiang

变更日志

v10.3.0 on 7/30/2023
17a72 - fix: unwrap reactive type (#3215)

Released under the MIT License.