fix(compiler-core): should apply text transform to if branches

fix #725
This commit is contained in:
Evan You
2020-02-14 15:57:14 -05:00
parent 80904e92b8
commit e0f3c6b352
5 changed files with 21 additions and 12 deletions

View File

@@ -16,7 +16,8 @@ export const transformText: NodeTransform = (node, context) => {
if (
node.type === NodeTypes.ROOT ||
node.type === NodeTypes.ELEMENT ||
node.type === NodeTypes.FOR
node.type === NodeTypes.FOR ||
node.type === NodeTypes.IF_BRANCH
) {
// perform the transform on node exit so that all expressions have already
// been processed.

View File

@@ -1,7 +1,7 @@
import {
createStructuralDirectiveTransform,
traverseChildren,
TransformContext
TransformContext,
traverseNode
} from '../transform'
import {
NodeTypes,
@@ -125,7 +125,7 @@ export function processIf(
const onExit = processCodegen && processCodegen(sibling, branch, false)
// since the branch was removed, it will not be traversed.
// make sure to traverse here.
traverseChildren(branch, context)
traverseNode(branch, context)
// call on exit
if (onExit) onExit()
// make sure to reset currentNode after traversal to indicate this