fix(compiler-core): fix forwarded slots detection on template slots (#4124)
fix #4123
This commit is contained in:
parent
6a0c7cd905
commit
c23153d82e
@ -771,6 +771,13 @@ describe('compiler: transform component slots', () => {
|
|||||||
const { slots } = parseWithSlots(`<Comp><slot v-for="a in b"/></Comp>`)
|
const { slots } = parseWithSlots(`<Comp><slot v-for="a in b"/></Comp>`)
|
||||||
expect(slots).toMatchObject(toMatch)
|
expect(slots).toMatchObject(toMatch)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('<slot> tag w/ template', () => {
|
||||||
|
const { slots } = parseWithSlots(
|
||||||
|
`<Comp><template #default><slot/></template></Comp>`
|
||||||
|
)
|
||||||
|
expect(slots).toMatchObject(toMatch)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('errors', () => {
|
describe('errors', () => {
|
||||||
|
@ -384,7 +384,8 @@ 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 &&
|
((child.tagType === ElementTypes.ELEMENT ||
|
||||||
|
child.tagType === ElementTypes.TEMPLATE) &&
|
||||||
hasForwardedSlots(child.children))
|
hasForwardedSlots(child.children))
|
||||||
) {
|
) {
|
||||||
return true
|
return true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user