Skip to content

Commit

Permalink
fix: add slotFlags for implicit default slots
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD committed Mar 29, 2023
1 parent 687be8a commit 6a883d2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/babel-plugin-jsx/src/transform-vue-jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,11 @@ const transformJSXElement = (
t.identifier('default'),
child,
),
]);
optimize && t.objectProperty(
t.identifier('_'),
t.numericLiteral(slotFlag),
) as any,
].filter(Boolean));
} else if (t.isObjectExpression(child)) {
VNodeChild = t.objectExpression([
...child.properties,
Expand All @@ -472,9 +476,13 @@ const transformJSXElement = (
VNodeChild = isComponent ? t.objectExpression([
t.objectProperty(
t.identifier('default'),
t.arrowFunctionExpression([], t.arrayExpression([child])),
t.arrowFunctionExpression([], child),
),
]) : t.arrayExpression([child]);
optimize && t.objectProperty(
t.identifier('_'),
t.numericLiteral(slotFlag),
) as any,
].filter(Boolean)) : t.arrayExpression([child]);
}
}

Expand Down

0 comments on commit 6a883d2

Please sign in to comment.