コンテンツへスキップ

toValue

カテゴリー
エクスポートサイズ
92 B
最終変更
先週
別名
resolveUnref
関連

値/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

ソース

ソースドキュメント

貢献者

Anthony Fu
Anthony Fu

変更履歴

v12.0.0-beta.1 2024/11/21
0a9ed - feat!: Vue 2 のサポートを削除、バンドルを最適化し、クリーンアップしました(#4349)
v10.0.0-beta.4 2023/04/13
4d757 - feat(types)!: MaybeComputedRefMaybeRefOrGetter にリネーム
0a72b - feat: resolveUnreftoValue にリネーム

MIT License の下でリリースされています。