浏览代码

chore: minor tweaks

daiwei 1 年之前
父节点
当前提交
06f525249d

+ 3 - 3
packages/compiler-vapor/__tests__/transforms/__snapshots__/vIf.spec.ts.snap

@@ -28,7 +28,7 @@ export function render(_ctx) {
   const n0 = _createIf(() => (_ctx.ok) ? () => {
     const n2 = t0()
     return n2
-  } : _ctx.orNot ? () => {
+  } : (_ctx.orNot) ? () => {
     const n5 = t1()
     const n6 = t2()
     return [n5, n6]
@@ -104,7 +104,7 @@ export function render(_ctx) {
   const n0 = _createIf(() => (_ctx.ok) ? () => {
     const n2 = t0()
     return n2
-  } : _ctx.orNot ? () => {
+  } : (_ctx.orNot) ? () => {
     const n4 = t1()
     return n4
   } : () => {
@@ -124,7 +124,7 @@ export function render(_ctx) {
   const n0 = _createIf(() => (_ctx.ok) ? () => {
     const n2 = t0()
     return n2
-  } : _ctx.orNot ? () => {
+  } : (_ctx.orNot) ? () => {
     const n4 = t1()
     return n4
   } : undefined)

+ 2 - 2
packages/compiler-vapor/src/generators/if.ts

@@ -14,9 +14,9 @@ export function genIf(
   const [frag, push] = buildCodeFragment()
 
   const codes: CodeFragment[] = [
-    isNested ? undefined : '() => (',
+    isNested ? '(' : '() => (',
     ...genExpression(condition, context),
-    isNested ? undefined : ')',
+    ')',
   ]
 
   let positiveArg = genBlock(positive, context)