Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit af75b64

Browse files
committed
feat: scope id for child component
1 parent 2476176 commit af75b64

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/runtime-vapor/src/apiRender.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export function setupComponent(instance: ComponentInternalInstance): void {
9292
}
9393
instance.block = block
9494
fallThroughAttrs(instance)
95+
attachScopeId(instance)
9596
return block
9697
})
9798
reset()
@@ -166,3 +167,16 @@ export function unmountComponent(instance: ComponentInternalInstance): void {
166167
)
167168
flushPostFlushCbs()
168169
}
170+
171+
export function attachScopeId(instance: ComponentInternalInstance): void {
172+
const scopeId = instance.type.__scopeId
173+
if (scopeId) {
174+
let blk: Block | null = instance.block
175+
while (blk && componentKey in blk) {
176+
blk = blk.block
177+
if (blk instanceof Element) {
178+
blk.setAttribute(scopeId, '')
179+
}
180+
}
181+
}
182+
}

0 commit comments

Comments
 (0)