]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: don't create comment anchor for v-else-if
authordaiwei <daiwei521@126.com>
Wed, 30 Jul 2025 08:54:58 +0000 (16:54 +0800)
committerdaiwei <daiwei521@126.com>
Wed, 30 Jul 2025 08:54:58 +0000 (16:54 +0800)
packages/compiler-vapor/src/generators/if.ts
packages/runtime-vapor/src/apiCreateIf.ts

index f4a3e599fab5ff9b8c282f5f3784d92321d7e1fa..3d16bee7c84bf3ce9b5061874d8ee748853ec78f 100644 (file)
@@ -38,6 +38,7 @@ export function genIf(
       positiveArg,
       negativeArg,
       once && 'true',
+      isNested && 'true',
     ),
   )
 
index bfa9e6e7af828916dd39393469add3c945c7fa77..ad8d4019f9295d50d2c014b34fa5ed81550ee591 100644 (file)
@@ -45,6 +45,7 @@ export function createIf(
   b1: BlockFn,
   b2?: BlockFn,
   once?: boolean,
+  elseIf?: boolean,
 ): Block {
   const _insertionParent = insertionParent
   const _insertionAnchor = insertionAnchor
@@ -55,7 +56,7 @@ export function createIf(
     frag = condition() ? b1() : b2 ? b2() : []
   } else {
     frag =
-      isHydrating || __DEV__
+      (isHydrating || __DEV__) && !elseIf
         ? new DynamicFragment(IF_ANCHOR_LABEL)
         : new DynamicFragment()
     if (isHydrating) {