mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2024-11-10 09:39:14 +08:00
merge onXXX
This commit is contained in:
parent
42e3292779
commit
c1a26926c9
@ -85,9 +85,14 @@ const transformJSXAttribute = (path, attributesToMerge, injected) => {
|
|||||||
if (name === 'on') {
|
if (name === 'on') {
|
||||||
const { properties = [] } = getJSXAttributeValue(path);
|
const { properties = [] } = getJSXAttributeValue(path);
|
||||||
properties.forEach((property) => {
|
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)) {
|
if (rootAttributes.includes(name) || eventRE.test(name)) {
|
||||||
attributesToMerge.push(
|
attributesToMerge.push(
|
||||||
|
Loading…
Reference in New Issue
Block a user