mirror of https://github.com/vuejs/core.git
feat: scope id for child component
This commit is contained in:
parent
247617612a
commit
af75b64b40
|
@ -92,6 +92,7 @@ export function setupComponent(instance: ComponentInternalInstance): void {
|
||||||
}
|
}
|
||||||
instance.block = block
|
instance.block = block
|
||||||
fallThroughAttrs(instance)
|
fallThroughAttrs(instance)
|
||||||
|
attachScopeId(instance)
|
||||||
return block
|
return block
|
||||||
})
|
})
|
||||||
reset()
|
reset()
|
||||||
|
@ -166,3 +167,16 @@ export function unmountComponent(instance: ComponentInternalInstance): void {
|
||||||
)
|
)
|
||||||
flushPostFlushCbs()
|
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, '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue