Skip to content
On this page

reactiveComputed

Category
Last Changed
6 months ago

Computed reactive object. Instead of returning a ref that computed does, reactiveComputedreturns a reactive object.

响应式对象的计算属性。不同于 computed 返回一个 ref,reactiveComputed返回一个响应式对象

This function uses Proxy

It is NOT supported by IE 11 or below.

Usage

import { reactiveComputed } from '@vueuse/core'

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

state.bar // 'baz'
import { reactiveComputed } from '@vueuse/core'

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

state.bar // 'baz'

Type Declarations

/**
 * Computed reactive object.
 */
export declare function reactiveComputed<T extends {}>(fn: () => T): T
/**
 * Computed reactive object.
 */
export declare function reactiveComputed<T extends {}>(fn: () => T): T

Source

SourceDocs

Contributors

Anthony Fu
lzdFeiFei
qiang

Changelog

No recent changes

Released under the MIT License.