Skip to content

useToString

Category
Export Size
145 B
Last Changed
3 hours ago

将 ref 转换为字符串。

使用方法

ts
import { useToString } from '@vueuse/core'
import { shallowRef } from 'vue'

const number = shallowRef(3.14)
const str = useToString(number)

str.value // '3.14'

Type Declarations

typescript
/**
 * Reactively convert a ref to string.
 *
 * @see https://vueuse.org/useToString
 */
export declare function useToString(
  value: MaybeRefOrGetter<unknown>,
): ComputedRef<string>

Source

SourceDocs

Contributors

jorshen

Changelog

No recent changes

Released under the MIT License.