Skip to content

Commit a7bdf1f

Browse files
committed
fix: add slotFlags for implicit default slots
1 parent 5e77d5d commit a7bdf1f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/babel-plugin-jsx/src/transform-vue-jsx.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,11 @@ const transformJSXElement = (
512512
) {
513513
VNodeChild = t.objectExpression([
514514
t.objectProperty(t.identifier('default'), child),
515-
]);
515+
optimize && t.objectProperty(
516+
t.identifier('_'),
517+
t.numericLiteral(slotFlag),
518+
) as any,
519+
].filter(Boolean));
516520
} else if (t.isObjectExpression(child)) {
517521
VNodeChild = t.objectExpression(
518522
[
@@ -526,9 +530,13 @@ const transformJSXElement = (
526530
? t.objectExpression([
527531
t.objectProperty(
528532
t.identifier('default'),
529-
t.arrowFunctionExpression([], t.arrayExpression([child]))
533+
t.arrowFunctionExpression([], child),
530534
),
531-
])
535+
optimize && t.objectProperty(
536+
t.identifier('_'),
537+
t.numericLiteral(slotFlag),
538+
) as any,
539+
].filter(Boolean))
532540
: t.arrayExpression([child]);
533541
}
534542
}

0 commit comments

Comments
 (0)