跳到主要內容

reactiveComputed

分類
導出大小
288 B
上次變更
上個月

計算後的響應式物件。與 computed 返回 ref 不同,reactiveComputed 返回響應式物件。

用法

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: ComputedGetter<T>,
): UnwrapNestedRefs<T>

原始碼

原始碼文件

貢獻者

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

變更日誌

v12.6.0 於 2025/2/14
bea31 - 修復:computed 函數應為 ComputedGetter (#4528)
v12.0.0-beta.1 於 2024/11/21
0a9ed - 特性!:移除 Vue 2 支援、最佳化捆綁包並清理 (#4349)
v10.3.0 於 2023/7/30
17a72 - 修復:解包響應式類型 (#3215)

以 MIT 授權條款發布。