fix: only pass string when children is string

This commit is contained in:
Amour1688 2020-06-14 22:42:47 +08:00
parent 92db537e84
commit 4180c849ac

View File

@ -358,7 +358,8 @@ const transformJSXElement = (t, path, state) => {
.join(', ');
const isComponent = checkIsComponent(t, path.get('openingElement'));
const child = children.elements.length === 1 ? children.elements[0] : children;
const child = children.elements.length === 1 && t.isStringLiteral(children.elements[0])
? children.elements[0] : children;
if (state.opts.compatibleProps && !state.get('compatibleProps')) {
state.set('compatibleProps', addDefault(
path, '@ant-design-vue/babel-helper-vue-compatible-props', { nameHint: '_compatibleProps' },