Skip to content

Commit

Permalink
feat: scope id for child component
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Nov 14, 2024
1 parent 2476176 commit af75b64
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/runtime-vapor/src/apiRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function setupComponent(instance: ComponentInternalInstance): void {
}
instance.block = block
fallThroughAttrs(instance)
attachScopeId(instance)
return block
})
reset()
Expand Down Expand Up @@ -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, '')
}
}
}
}

0 comments on commit af75b64

Please sign in to comment.