toValue
値/ref/getterの値を取得します。
使用方法
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
ソース
貢献者
変更履歴
v12.0.0-beta.1
2024/11/21v10.0.0-beta.4
2023/04/134d757
- feat(types)!: MaybeComputedRef
を MaybeRefOrGetter
にリネーム0a72b
- feat: resolveUnref
を toValue
にリネーム