diff --git a/packages/compiler-core/src/transforms/vFor.ts b/packages/compiler-core/src/transforms/vFor.ts index 9081cb3f..d8a8fe1b 100644 --- a/packages/compiler-core/src/transforms/vFor.ts +++ b/packages/compiler-core/src/transforms/vFor.ts @@ -20,7 +20,8 @@ import { SlotOutletNode, ElementNode, DirectiveNode, - ForNode + ForNode, + PlainElementNode } from '../ast' import { createCompilerError, ErrorCodes } from '../errors' import { @@ -70,6 +71,9 @@ export const transformFor = createStructuralDirectiveTransform( // finish the codegen now that all children have been traversed let childBlock const isTemplate = isTemplateNode(node) + const { children } = forNode + const needFragmentWrapper = + children.length > 1 || children[0].type !== NodeTypes.ELEMENT const slotOutlet = isSlotOutlet(node) ? node : isTemplate && @@ -94,8 +98,8 @@ export const transformFor = createStructuralDirectiveTransform( // the props for renderSlot is passed as the 3rd argument. injectProp(childBlock, keyProperty, context) } - } else if (isTemplate) { - //