Skip to content
On this page

resolveRef

Normalize value/ref/getter to ref or computed.

Usage

ts
import { resolveRef } from '@vueuse/core'

const foo = ref('hi')

const a = resolveRef(0) // Ref<number>
const b = resolveRef(foo) // Ref<string>
const c = resolveRef(() => 'hi') // ComputedRef<string>
import { resolveRef } from '@vueuse/core'

const foo = ref('hi')

const a = resolveRef(0) // Ref<number>
const b = resolveRef(foo) // Ref<string>
const c = resolveRef(() => 'hi') // ComputedRef<string>

Type Declarations

typescript
/**
 * Normalize value/ref/getter to `ref` or `computed`.
 */
export declare function resolveRef<T>(r: MaybeComputedRef<T>): ComputedRef<T>
export declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>
export declare function resolveRef<T>(r: T): Ref<T>
/**
 * Normalize value/ref/getter to `ref` or `computed`.
 */
export declare function resolveRef<T>(r: MaybeComputedRef<T>): ComputedRef<T>
export declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>
export declare function resolveRef<T>(r: T): Ref<T>

Source

Category
Export Size
188 B
Last Changed
3 months ago
Related

SourceDocs

贡献者(Contributors)

日志(Changelog)

No recent changes

Released under the MIT License.