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

Function updateTemplateRef

src/utils/instance.ts:80–105  ·  view source on GitHub ↗
(vm: ComponentInstance)

Source from the content-addressed store, hash-verified

78}
79
80function updateTemplateRef(vm: ComponentInstance) {
81 const rawBindings = vmStateManager.get(vm, 'rawBindings') || {}
82 if (!rawBindings || !Object.keys(rawBindings).length) return
83
84 const refs = vm.$refs
85 const oldRefKeys = vmStateManager.get(vm, 'refs') || []
86 for (let index = 0; index < oldRefKeys.length; index++) {
87 const key = oldRefKeys[index]
88 const setupValue = rawBindings[key]
89 if (!refs[key] && setupValue && isRef(setupValue)) {
90 setupValue.value = null
91 }
92 }
93
94 const newKeys = Object.keys(refs)
95 const validNewKeys = []
96 for (let index = 0; index < newKeys.length; index++) {
97 const key = newKeys[index]
98 const setupValue = rawBindings[key]
99 if (refs[key] && setupValue && isRef(setupValue)) {
100 setupValue.value = refs[key]
101 validNewKeys.push(key)
102 }
103 }
104 vmStateManager.set(vm, 'refs', validNewKeys)
105}
106
107export function afterRender(vm: ComponentInstance) {
108 const stack = [(vm as any)._vnode as VNode]

Callers 1

afterRenderFunction · 0.85

Calls 3

isRefFunction · 0.85
setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…