主题
toValue
获取 value/ref/getter 的值。
¥Get the value of value/ref/getter.
用法
¥Usage
ts
import { toValue } from '@vueuse/core'
const foo = ref('hi')
const a = toValue(0) // 0
const b = toValue(foo) // 'hi'
const c = toValue(() => 'hi') // 'hi'
类型声明
typescript
/**
* Get the value of value/ref/getter.
*/
export declare function toValue<T>(r: MaybeRefOrGetter<T>): T
/**
* @deprecated use `toValue` instead
*/
export declare const resolveUnref: typeof toValue