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

Function resolveScopedSlots

src/utils/instance.ts:162–188  ·  view source on GitHub ↗
(
  vm: ComponentInstance,
  slotsProxy: InternalSlots
)

Source from the content-addressed store, hash-verified

160}
161
162export function resolveScopedSlots(
163 vm: ComponentInstance,
164 slotsProxy: InternalSlots
165): void {
166 const parentVNode = (vm.$options as any)._parentVnode
167 if (!parentVNode) return
168
169 const prevSlots = vmStateManager.get(vm, 'slots') || []
170 const curSlots = resolveSlots(parentVNode.data.scopedSlots, vm.$slots)
171 // remove staled slots
172 for (let index = 0; index < prevSlots.length; index++) {
173 const key = prevSlots[index]
174 if (!curSlots[key]) {
175 delete slotsProxy[key]
176 }
177 }
178
179 // proxy fresh slots
180 const slotNames = Object.keys(curSlots)
181 for (let index = 0; index < slotNames.length; index++) {
182 const key = slotNames[index]
183 if (!slotsProxy[key]) {
184 slotsProxy[key] = createSlotProxy(vm, key)
185 }
186 }
187 vmStateManager.set(vm, 'slots', slotNames)
188}
189
190export function activateCurrentInstance(
191 instance: ComponentInternalInstance,

Callers 1

initSetupFunction · 0.90

Calls 4

resolveSlotsFunction · 0.90
createSlotProxyFunction · 0.90
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…