Skip to content

Commit

Permalink
fix(transformElement): sub-component‘s direct child should openBlock (f…
Browse files Browse the repository at this point in the history
…ix vuejs#766)
  • Loading branch information
ysj16 committed Feb 25, 2020
1 parent e52a917 commit 10456fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/compiler-core/src/transforms/transformElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/helpers/renderSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
}

0 comments on commit 10456fa

Please sign in to comment.