@@ -8,7 +8,8 @@ import {
|
||||
normalizeClass,
|
||||
normalizeStyle,
|
||||
PatchFlags,
|
||||
ShapeFlags
|
||||
ShapeFlags,
|
||||
SlotFlags
|
||||
} from '@vue/shared'
|
||||
import {
|
||||
ComponentInternalInstance,
|
||||
@@ -542,10 +543,22 @@ export function normalizeChildren(vnode: VNode, children: unknown) {
|
||||
return
|
||||
} else {
|
||||
type = ShapeFlags.SLOTS_CHILDREN
|
||||
if (!(children as RawSlots)._ && !(InternalObjectKey in children!)) {
|
||||
const slotFlag = (children as RawSlots)._
|
||||
if (!slotFlag && !(InternalObjectKey in children!)) {
|
||||
// if slots are not normalized, attach context instance
|
||||
// (compiled / normalized slots already have context)
|
||||
;(children as RawSlots)._ctx = currentRenderingInstance
|
||||
} else if (slotFlag === SlotFlags.FORWARDED && currentRenderingInstance) {
|
||||
// a child component receives forwarded slots from the parent.
|
||||
// its slot type is determined by its parent's slot type.
|
||||
if (
|
||||
currentRenderingInstance.vnode.patchFlag & PatchFlags.DYNAMIC_SLOTS
|
||||
) {
|
||||
;(children as RawSlots)._ = SlotFlags.DYNAMIC
|
||||
vnode.patchFlag |= PatchFlags.DYNAMIC_SLOTS
|
||||
} else {
|
||||
;(children as RawSlots)._ = SlotFlags.STABLE
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (isFunction(children)) {
|
||||
|
||||
Reference in New Issue
Block a user