From: 三咲智子 Kevin Deng Date: Thu, 14 Nov 2024 12:52:19 +0000 (+0800) Subject: feat: scope id for child component X-Git-Tag: v3.6.0-alpha.1~16^2~284 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af75b64b40b7a2df672f1b26ec4f22e6c5e9cd9c;p=thirdparty%2Fvuejs%2Fcore.git feat: scope id for child component --- diff --git a/packages/runtime-vapor/src/apiRender.ts b/packages/runtime-vapor/src/apiRender.ts index 751a92c056..26a9b98cb7 100644 --- a/packages/runtime-vapor/src/apiRender.ts +++ b/packages/runtime-vapor/src/apiRender.ts @@ -92,6 +92,7 @@ export function setupComponent(instance: ComponentInternalInstance): void { } instance.block = block fallThroughAttrs(instance) + attachScopeId(instance) return block }) reset() @@ -166,3 +167,16 @@ export function unmountComponent(instance: ComponentInternalInstance): void { ) flushPostFlushCbs() } + +export function attachScopeId(instance: ComponentInternalInstance): void { + const scopeId = instance.type.__scopeId + if (scopeId) { + let blk: Block | null = instance.block + while (blk && componentKey in blk) { + blk = blk.block + if (blk instanceof Element) { + blk.setAttribute(scopeId, '') + } + } + } +}