MCPcopy
hub / github.com/vuejs/composition-api / toRef

Function toRef

src/reactivity/ref.ts:155–167  ·  view source on GitHub ↗
(
  object: T,
  key: K
)

Source from the content-addressed store, hash-verified

153}
154
155export function toRef<T extends object, K extends keyof T>(
156 object: T,
157 key: K
158): Ref<T[K]> {
159 if (!(key in object)) set(object, key, undefined)
160 const v = object[key]
161 if (isRef<T[K]>(v)) return v
162
163 return createRef({
164 get: () => object[key],
165 set: (v) => (object[key] = v),
166 })
167}
168
169export function shallowRef<T extends object>(
170 value: T

Callers 3

setupFunction · 0.90
ref.spec.tsFile · 0.90
toRefsFunction · 0.85

Calls 3

setFunction · 0.90
isRefFunction · 0.85
createRefFunction · 0.85

Tested by 1

setupFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…