fix: make sure v-if and v-for work together

This commit is contained in:
Evan You
2019-09-22 20:55:18 -04:00
parent 3415bbd823
commit 0af0febfc2
2 changed files with 26 additions and 24 deletions

View File

@@ -1,4 +1,7 @@
import { createStructuralDirectiveTransform } from '../transform'
import {
createStructuralDirectiveTransform,
traverseChildren
} from '../transform'
import {
NodeTypes,
ElementTypes,
@@ -37,6 +40,9 @@ export const transformIf = createStructuralDirectiveTransform(
branch.children = [...comments, ...branch.children]
}
sibling.branches.push(branch)
// since the branch was removed, it will not be traversed.
// make sure to traverse here.
traverseChildren(branch, context)
} else {
context.onError(
createCompilerError(