主题
createRef
根据 deep 参数返回 deepRef 或 shallowRef。
¥Returns a deepRef or shallowRef depending on the deep param.
用法
¥Usage
ts
import { createRef } from '@vueuse/core'
import { isShallow, ref } from 'vue'
const initialData = 1
const shallowData = createRef(initialData)
const deepData = createRef(initialData, true)
isShallow(shallowData) // true
isShallow(deepData) // falsejs
import { createRef } from '@vueuse/core'
import { isShallow } from 'vue'
const initialData = 1
const shallowData = createRef(initialData)
const deepData = createRef(initialData, true)
isShallow(shallowData) // true
isShallow(deepData) // false