Procházet zdrojové kódy

fix(compiler): props hoist should also work on elements w/ TEXT flag

Evan You před 6 roky
rodič
revize
21666243e9

+ 5 - 1
packages/compiler-core/src/transforms/hoistStatic.ts

@@ -35,7 +35,11 @@ function walk(
         // node may contain dynamic children, but its props may be eligible for
         // node may contain dynamic children, but its props may be eligible for
         // hoisting.
         // hoisting.
         const flag = getPatchFlag(child)
         const flag = getPatchFlag(child)
-        if (!flag || flag === PatchFlags.NEED_PATCH) {
+        if (
+          !flag ||
+          flag === PatchFlags.NEED_PATCH ||
+          flag === PatchFlags.TEXT
+        ) {
           let codegenNode = child.codegenNode as CallExpression
           let codegenNode = child.codegenNode as CallExpression
           if (codegenNode.callee.includes(APPLY_DIRECTIVES)) {
           if (codegenNode.callee.includes(APPLY_DIRECTIVES)) {
             codegenNode = codegenNode.arguments[0] as CallExpression
             codegenNode = codegenNode.arguments[0] as CallExpression