コンテンツにスキップ

reactiveComputed

カテゴリ
エクスポートサイズ
264 バイト
最終更新日
先週

リアクティブな算出オブジェクト。 `computed` が ref を返すのに対し、`reactiveComputed` はリアクティブなオブジェクトを返します。

この関数は Proxy を使用します。

IE 11 以前ではサポートされていませんIE 11 以前のブラウザ

使用方法

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>

ソース

ソースドキュメント

貢献者

Anthony Fu
Anthony Fu
三咲智子 Kevin Deng
qiang

変更履歴

v12.0.0-beta.1 2024/11/21
0a9ed - feat!: Vue 2 サポートの削除、バンドルの最適化、クリーンアップ (#4349)
v10.3.0 2023/7/30
17a72 - fix: リアクティブタイプのアンラップ (#3215)

MITライセンスでリリースされています。