Explorar el Código

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

Evan You hace 6 años
padre
commit
21666243e9
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      packages/compiler-core/src/transforms/hoistStatic.ts

+ 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
         // hoisting.
         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
           if (codegenNode.callee.includes(APPLY_DIRECTIVES)) {
             codegenNode = codegenNode.arguments[0] as CallExpression