fix(compiler-core): detected forwarded slots in nested components (#4268)
fix #4244
This commit is contained in:
parent
a211e271ee
commit
abb3a81e87
@ -778,6 +778,13 @@ describe('compiler: transform component slots', () => {
|
|||||||
)
|
)
|
||||||
expect(slots).toMatchObject(toMatch)
|
expect(slots).toMatchObject(toMatch)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('<slot w/ nested component>', () => {
|
||||||
|
const { slots } = parseWithSlots(
|
||||||
|
`<Comp><Comp><slot/></Comp></Comp>`
|
||||||
|
)
|
||||||
|
expect(slots).toMatchObject(toMatch)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('errors', () => {
|
describe('errors', () => {
|
||||||
|
@ -384,9 +384,7 @@ function hasForwardedSlots(children: TemplateChildNode[]): boolean {
|
|||||||
case NodeTypes.ELEMENT:
|
case NodeTypes.ELEMENT:
|
||||||
if (
|
if (
|
||||||
child.tagType === ElementTypes.SLOT ||
|
child.tagType === ElementTypes.SLOT ||
|
||||||
((child.tagType === ElementTypes.ELEMENT ||
|
hasForwardedSlots(child.children)
|
||||||
child.tagType === ElementTypes.TEMPLATE) &&
|
|
||||||
hasForwardedSlots(child.children))
|
|
||||||
) {
|
) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user