diff --git a/packages/compiler-core/src/transforms/transformElement.ts b/packages/compiler-core/src/transforms/transformElement.ts index 905268dee31..fe0a5afb7b9 100644 --- a/packages/compiler-core/src/transforms/transformElement.ts +++ b/packages/compiler-core/src/transforms/transformElement.ts @@ -134,6 +134,11 @@ export const transformElement: NodeTransform = (node, context) => { if (hasDynamicSlots) { patchFlag |= PatchFlags.DYNAMIC_SLOTS } + + // sub-component‘s direct child should openBlock + for (let i = 0; i < node.children.length; i++) { + node.children[i].codegenNode!.isBlock = true + } } else if (node.children.length === 1) { const child = node.children[0] const type = child.type diff --git a/packages/runtime-core/src/helpers/renderSlot.ts b/packages/runtime-core/src/helpers/renderSlot.ts index a6c2d47e7aa..eb16bc02200 100644 --- a/packages/runtime-core/src/helpers/renderSlot.ts +++ b/packages/runtime-core/src/helpers/renderSlot.ts @@ -35,7 +35,7 @@ export function renderSlot( Fragment, { key: props.key }, slot ? slot(props) : fallback || [], - slots._ ? PatchFlags.STABLE_FRAGMENT : PatchFlags.BAIL + slots._ ? 0 : PatchFlags.BAIL ) ) }