reactiveComputed
計算後的響應式物件。與 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>