跳到内容

reactiveComputed

Category
导出大小
288 B
Last Changed
last month

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'

Type Declarations

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

Source

SourceDocs

Contributors

Anthony Fu
Anthony Fu
Robin
sibbng
三咲智子 Kevin Deng
qiang

Changelog

v12.6.0 on 2/14/2025
bea31 - fix: computed fn should be ComputedGetter (#4528)
v12.0.0-beta.1 on 11/21/2024
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
v10.3.0 on 7/30/2023
17a72 - fix: unwrap reactive type (#3215)

在 MIT 许可证下发布。