]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: minor tweaks edison/refactor/createIf 12629/head
authordaiwei <daiwei521@126.com>
Wed, 1 Jan 2025 10:25:22 +0000 (18:25 +0800)
committerdaiwei <daiwei521@126.com>
Wed, 1 Jan 2025 10:25:22 +0000 (18:25 +0800)
packages/compiler-vapor/__tests__/transforms/__snapshots__/vIf.spec.ts.snap
packages/compiler-vapor/src/generators/if.ts

index 419c8420d50e2a51276eabd5a0b9cf3ae3a309f9..bf02b33c0cce2bc49a8b9b46586a1863d04cd130 100644 (file)
@@ -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)
index 198c588cd7926b7586621c14f749af3c52c5e427..d6b320d66d9b6db496f9f277528837edc80a36c0 100644 (file)
@@ -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)