]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: improve
authordaiwei <daiwei521@126.com>
Sun, 9 Mar 2025 14:11:37 +0000 (22:11 +0800)
committerdaiwei <daiwei521@126.com>
Sun, 9 Mar 2025 14:11:52 +0000 (22:11 +0800)
packages/compiler-vapor/src/transforms/transformTransition.ts

index 857e3bcdf2cc47c9ed5cff35548fa7d84b694be5..6014235083185475efcab86b87504e4b81fad761 100644 (file)
@@ -32,16 +32,11 @@ function hasMultipleChildren(node: ElementNode): boolean {
 
   const first = children[0]
 
-  // template
-  if (first && isTemplateNode(first)) {
-    return true
-  }
-
   // has v-for
   if (
     children.length === 1 &&
     first.type === NodeTypes.ELEMENT &&
-    findDir(first, 'for')
+    (findDir(first, 'for') || isTemplateNode(first))
   ) {
     return true
   }
@@ -51,10 +46,11 @@ function hasMultipleChildren(node: ElementNode): boolean {
 
   // has v-if/v-else-if/v-else
   if (
-    children.length > 1 &&
     children.every(
       (c, index) =>
         c.type === NodeTypes.ELEMENT &&
+        // not template
+        !isTemplateNode(c) &&
         // not has v-for
         !findDir(c, 'for') &&
         // if the first child has v-if, the rest should also have v-else-if/v-else