fix(sfc): inherit parent scopeId on child rooot (#756)

This commit is contained in:
hareku
2020-02-21 22:44:13 +09:00
committed by GitHub
parent 1b9b235663
commit 9547c2b93d
5 changed files with 41 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ export function renderComponentRoot(
): VNode {
const {
type: Component,
parent,
vnode,
proxy,
withProxy,
@@ -102,6 +103,11 @@ export function renderComponentRoot(
if (vnodeHooks !== EMPTY_OBJ) {
result = cloneVNode(result, vnodeHooks)
}
// inherit scopeId
const parentScopeId = parent && parent.type.__scopeId
if (parentScopeId) {
result = cloneVNode(result, { [parentScopeId]: '' })
}
// inherit directives
if (vnode.dirs != null) {
if (__DEV__ && !isElementRoot(result)) {
@@ -127,6 +133,7 @@ export function renderComponentRoot(
result = createVNode(Comment)
}
currentRenderingInstance = null
return result
}