fix(sfc): fix scoped style regression for child component with single root + comment

fix #2046
This commit is contained in:
Evan You
2020-09-04 11:36:55 -04:00
parent 5f4053967c
commit 6dbc6c4cd0
2 changed files with 26 additions and 34 deletions

View File

@@ -19,6 +19,7 @@ import {
setupComponent
} from './component'
import {
filterSingleRoot,
renderComponentRoot,
shouldUpdateComponent,
updateHOCHostEl
@@ -746,30 +747,6 @@ function baseCreateRenderer(
}
// scopeId
setScopeId(el, scopeId, vnode, parentComponent)
// if (scopeId) {
// hostSetScopeId(el, scopeId)
// }
// if (parentComponent) {
// const treeOwnerId = parentComponent.type.__scopeId
// // vnode's own scopeId and the current patched component's scopeId is
// // different - this is a slot content node.
// if (treeOwnerId && treeOwnerId !== scopeId) {
// hostSetScopeId(el, treeOwnerId + '-s')
// }
// const parentScopeId =
// vnode === parentComponent.subTree && parentComponent.vnode.scopeId
// if (parentScopeId) {
// hostSetScopeId(el, parentScopeId)
// if (parentComponent.parent) {
// const treeOwnerId = parentComponent.parent.type.__scopeId
// // vnode's own scopeId and the current patched component's scopeId is
// // different - this is a slot content node.
// if (treeOwnerId && treeOwnerId !== parentScopeId) {
// hostSetScopeId(el, treeOwnerId + '-s')
// }
// }
// }
// }
}
if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
Object.defineProperty(el, '__vnode', {
@@ -823,7 +800,12 @@ function baseCreateRenderer(
if (treeOwnerId && treeOwnerId !== scopeId) {
hostSetScopeId(el, treeOwnerId + '-s')
}
if (vnode === parentComponent.subTree) {
let subTree = parentComponent.subTree
if (__DEV__ && subTree.type === Fragment) {
subTree =
filterSingleRoot(subTree.children as VNodeArrayChildren) || subTree
}
if (vnode === subTree) {
setScopeId(
el,
parentComponent.vnode.scopeId,