Skip to content

Commit 6a883d2

Browse files
committed
fix: add slotFlags for implicit default slots
1 parent 687be8a commit 6a883d2

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
@@ -459,7 +459,11 @@ const transformJSXElement = (
459459
t.identifier('default'),
460460
child,
461461
),
462-
]);
462+
optimize && t.objectProperty(
463+
t.identifier('_'),
464+
t.numericLiteral(slotFlag),
465+
) as any,
466+
].filter(Boolean));
463467
} else if (t.isObjectExpression(child)) {
464468
VNodeChild = t.objectExpression([
465469
...child.properties,
@@ -472,9 +476,13 @@ const transformJSXElement = (
472476
VNodeChild = isComponent ? t.objectExpression([
473477
t.objectProperty(
474478
t.identifier('default'),
475-
t.arrowFunctionExpression([], t.arrayExpression([child])),
479+
t.arrowFunctionExpression([], child),
476480
),
477-
]) : t.arrayExpression([child]);
481+
optimize && t.objectProperty(
482+
t.identifier('_'),
483+
t.numericLiteral(slotFlag),
484+
) as any,
485+
].filter(Boolean)) : t.arrayExpression([child]);
478486
}
479487
}
480488

0 commit comments

Comments
 (0)