From 4180c849ace57be716112b974c68462a696a42b7 Mon Sep 17 00:00:00 2001 From: Amour1688 Date: Sun, 14 Jun 2020 22:42:47 +0800 Subject: [PATCH] fix: only pass string when children is string --- packages/babel-plugin-jsx/src/transform-vue-jsx.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/babel-plugin-jsx/src/transform-vue-jsx.js b/packages/babel-plugin-jsx/src/transform-vue-jsx.js index b8b4c60..690647d 100644 --- a/packages/babel-plugin-jsx/src/transform-vue-jsx.js +++ b/packages/babel-plugin-jsx/src/transform-vue-jsx.js @@ -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' },