MCPcopy
hub / github.com/vuejs/core / initSlots

Function initSlots

packages/runtime-core/src/componentSlots.ts:185–205  ·  view source on GitHub ↗
(
  instance: ComponentInternalInstance,
  children: VNodeNormalizedChildren,
  optimized: boolean,
)

Source from the content-addressed store, hash-verified

183}
184
185export const initSlots = (
186 instance: ComponentInternalInstance,
187 children: VNodeNormalizedChildren,
188 optimized: boolean,
189): void => {
190 const slots = (instance.slots = createInternalObject())
191 if (instance.vnode.shapeFlag & ShapeFlags.SLOTS_CHILDREN) {
192 const type = (children as RawSlots)._
193 if (type) {
194 assignSlots(slots, children as Slots, optimized)
195 // make compiler marker non-enumerable
196 if (optimized) {
197 def(slots, '_', type, true)
198 }
199 } else {
200 normalizeObjectSlots(children as RawSlots, slots, instance)
201 }
202 } else if (children) {
203 normalizeVNodeSlots(instance, children)
204 }
205}
206
207export const updateSlots = (
208 instance: ComponentInternalInstance,

Callers 1

setupComponentFunction · 0.90

Calls 5

createInternalObjectFunction · 0.90
defFunction · 0.90
assignSlotsFunction · 0.85
normalizeObjectSlotsFunction · 0.85
normalizeVNodeSlotsFunction · 0.85

Tested by

no test coverage detected