فهرست منبع

fix(compiler-dom): style transform of static styles should not add STYLE patchFlag

Evan You 6 سال پیش
والد
کامیت
113339c7b6
2فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 2 1
      packages/compiler-core/src/transform.ts
  2. 2 0
      packages/compiler-dom/__tests__/transforms/transformStyle.spec.ts

+ 2 - 1
packages/compiler-core/src/transform.ts

@@ -215,7 +215,8 @@ function createTransformContext(
       return createSimpleExpression(
         `_hoisted_${context.hoists.length}`,
         false,
-        exp.loc
+        exp.loc,
+        true
       )
     },
     cache(exp) {

+ 2 - 0
packages/compiler-dom/__tests__/transforms/transformStyle.spec.ts

@@ -77,5 +77,7 @@ describe('compiler: style transform', () => {
         }
       ]
     })
+    // should not cause the STYLE patchFlag to be attached
+    expect((node.codegenNode as CallExpression).arguments.length).toBe(2)
   })
 })