mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-07-19 22:19:57 +08:00
feat: compatible with Vue 2.x
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
"url": "https://github.com/vueComponent/jsx/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design-vue/babel-helper-vue-compatible-props": "^1.0.0",
|
||||
"@ant-design-vue/babel-helper-vue-transform-on": "^1.0.0",
|
||||
"@babel/helper-module-imports": "^7.0.0",
|
||||
"@babel/plugin-syntax-jsx": "^7.0.0",
|
||||
|
@ -292,9 +292,13 @@ const transformJSXElement = (t, path, state) => {
|
||||
const directives = [];
|
||||
const tag = getTag(t, path);
|
||||
const children = t.arrayExpression(getChildren(t, path.get('children')));
|
||||
const attributes = getAttributes(t, path, state, directives);
|
||||
const compatibleProps = addDefault(
|
||||
path, '@ant-design-vue/babel-helper-vue-compatible-props', { nameHint: '_compatibleProps' },
|
||||
);
|
||||
const h = t.callExpression(state.h, [
|
||||
tag,
|
||||
getAttributes(t, path, state, directives),
|
||||
state.opts.compatibleProps ? t.callExpression(compatibleProps, [attributes]) : attributes,
|
||||
!t.isStringLiteral(tag) && !tag.name.includes('Fragment')
|
||||
? t.objectExpression([
|
||||
t.objectProperty(
|
||||
|
Reference in New Issue
Block a user