mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2024-11-10 09:39:14 +08:00
fix: add slotFlags for implicit default slots
This commit is contained in:
parent
687be8aca8
commit
abc2d8ed9c
@ -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,
|
||||
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,8 @@ _createVNode(_resolveComponent(\\"A\\"), null, {
|
||||
exports[`passing object slots via JSX children single expression, function expression: single expression, function expression 1`] = `
|
||||
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
|
||||
_createVNode(_resolveComponent(\\"A\\"), null, {
|
||||
default: () => \\"foo\\"
|
||||
default: () => \\"foo\\",
|
||||
_: 1
|
||||
});"
|
||||
`;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user