merge onXXX

This commit is contained in:
Amour1688 2020-05-16 23:57:10 +08:00
parent 42e3292779
commit c1a26926c9

View File

@ -85,9 +85,14 @@ const transformJSXAttribute = (path, attributesToMerge, injected) => {
if (name === 'on') {
const { properties = [] } = getJSXAttributeValue(path);
properties.forEach((property) => {
property.key = t.identifier(transformOn(property.key.name));
attributesToMerge.push(t.objectExpression([
t.objectProperty(
t.identifier(transformOn(property.key.name)),
property.value,
),
]));
});
return t.spreadElement(t.objectExpression(properties));
return null;
}
if (rootAttributes.includes(name) || eventRE.test(name)) {
attributesToMerge.push(