Jelajahi Sumber

fix(runtime-vapor): attach scope id only to root sub-element

三咲智子 Kevin Deng 1 tahun lalu
induk
melakukan
4078206e16
1 mengubah file dengan 6 tambahan dan 2 penghapusan
  1. 6 2
      packages/runtime-vapor/src/apiCreateComponent.ts

+ 6 - 2
packages/runtime-vapor/src/apiCreateComponent.ts

@@ -31,9 +31,13 @@ export function createComponent(
     once,
   )
 
-  instance.scopeIds = [...current.scopeIds]
+  if (singleRoot) {
+    instance.scopeIds.push(...current.scopeIds)
+  }
   const scopeId = current.type.__scopeId
-  if (scopeId) instance.scopeIds.push(scopeId)
+  if (scopeId) {
+    instance.scopeIds.push(scopeId)
+  }
 
   setupComponent(instance)