fix(compiler): v-for fragments should be blocks

This commit is contained in:
Evan You
2019-10-02 10:47:01 -04:00
parent 191db785bd
commit bec01c93bd
6 changed files with 96 additions and 80 deletions

View File

@@ -176,7 +176,8 @@ function createChildrenCodegenNode(
if (children.length === 1) {
// optimize away nested fragments when child is a ForNode
if (child.type === NodeTypes.FOR) {
const forBlockArgs = child.codegenNode.arguments
const forBlockArgs = (child.codegenNode
.expressions[1] as CallExpression).arguments
// directly use the for block's children and patchFlag
blockArgs[2] = forBlockArgs[2]
blockArgs[3] = forBlockArgs[3]