fix(compiler): properly bail stringfication for nested slot elements
This commit is contained in:
parent
aea88c3280
commit
f74b16ccfe
@ -111,7 +111,14 @@ function walk(
|
||||
|
||||
// walk further
|
||||
if (child.type === NodeTypes.ELEMENT) {
|
||||
const isComponent = child.tagType === ElementTypes.COMPONENT
|
||||
if (isComponent) {
|
||||
context.scopes.vSlot++
|
||||
}
|
||||
walk(child, context)
|
||||
if (isComponent) {
|
||||
context.scopes.vSlot--
|
||||
}
|
||||
} else if (child.type === NodeTypes.FOR) {
|
||||
// Do not hoist v-for single child because it has to be a block
|
||||
walk(child, context, child.children.length === 1)
|
||||
|
@ -60,11 +60,8 @@ type StringifiableNode = PlainElementNode | TextCallNode
|
||||
* This optimization is only performed in Node.js.
|
||||
*/
|
||||
export const stringifyStatic: HoistTransform = (children, context, parent) => {
|
||||
if (
|
||||
parent.type === NodeTypes.ELEMENT &&
|
||||
(parent.tagType === ElementTypes.COMPONENT ||
|
||||
parent.tagType === ElementTypes.TEMPLATE)
|
||||
) {
|
||||
// bail stringification for slot content
|
||||
if (context.scopes.vSlot > 0) {
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user