MCPcopy Create free account
hub / github.com/MMmaXingXing/mini-vue / initSlots

Function initSlots

code/src/runtime-core/componentSlots.ts:3–11  ·  view source on GitHub ↗
(instance, children)

Source from the content-addressed store, hash-verified

1import { ShapeFlags } from "../shared/ShapeFlags";
2
3export const initSlots = (instance, children) => {
4 // 数组类型结构渲染
5 // instance.slots = Array.isArray(children) ? children : [children];
6
7 const { vnode } = instance;
8 if (vnode.shapeFlag & ShapeFlags.SLOT_CHILDREN) {
9 normalizeObjectSlots(children, instance.slots);
10 }
11};
12
13const normalizeObjectSlots = (children, slots) => {
14 for (const key in children) {

Callers 1

setupComponentFunction · 0.90

Calls 1

normalizeObjectSlotsFunction · 0.70

Tested by

no test coverage detected