Просмотр исходного кода

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

三咲智子 Kevin Deng 1 год назад
Родитель
Сommit
4078206e16
1 измененных файлов с 6 добавлено и 2 удалено
  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)