Jelajahi Sumber

fix: fix child index

daiwei 10 bulan lalu
induk
melakukan
3fca1f510d
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 2 1
      packages/compiler-vapor/src/generators/template.ts

+ 2 - 1
packages/compiler-vapor/src/generators/template.ts

@@ -89,7 +89,8 @@ export function genChildren(
       // child index is used to find the child during hydration.
       // if offset is not 0, we need to specify the offset to skip the dynamic
       // children and get the correct child.
-      const asAnchor = children.some(child => child.anchor === id)
+      const asAnchor =
+        id !== undefined && children.some(child => child.anchor === id)
       let childIndex =
         offset === 0
           ? undefined