destructComputed

Commons
stable

Converts a computed getter that returns an object into individual reactive refs, one per key. Lets you destructure a computed without losing reactivity.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

getter
required
ComputedGetter<T & TNotAUnion<T>>
A function used as the computed getter. It must return a plain object whose keys will each become a reactive ref.

API

Return value

The value returned by this util.

An object of Vue refs, one per key of the value returned by the getter. Each ref updates automatically when the computed changes.

Usage

Examples

Ready-to-paste usage snippets.

Destructure a computed object reactively

typescript