fix: missing colon in event name for dynamic model arguments (#642)

This commit is contained in:
Kael 2024-09-11 21:22:27 +10:00 committed by GitHub
parent 8de3f20221
commit ad14b2d94a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -208,7 +208,7 @@ const buildProps = (path: NodePath<t.JSXElement>, state: State) => {
}
const updateName = isDynamic
? t.binaryExpression('+', t.stringLiteral('onUpdate'), propName)
? t.binaryExpression('+', t.stringLiteral('onUpdate:'), propName)
: t.stringLiteral(
`onUpdate:${
(propName as t.StringLiteral)?.value || 'modelValue'

View File

@ -269,7 +269,7 @@ const b = {
};
_createVNode(_Fragment, null, [_createVNode(_resolveComponent("A"), {
[foo]: xx,
["onUpdate" + foo]: $event => xx = $event
["onUpdate:" + foo]: $event => xx = $event
}, null, 16), _createVNode(_resolveComponent("B"), {
"modelValue": xx,
"modelModifiers": {
@ -281,25 +281,25 @@ _createVNode(_Fragment, null, [_createVNode(_resolveComponent("A"), {
[foo + "Modifiers"]: {
"a": true
},
["onUpdate" + foo]: $event => xx = $event
["onUpdate:" + foo]: $event => xx = $event
}, null, 16), _createVNode(_resolveComponent("D"), {
[foo === 'foo' ? 'a' : 'b']: xx,
[(foo === 'foo' ? 'a' : 'b') + "Modifiers"]: {
"a": true
},
["onUpdate" + (foo === 'foo' ? 'a' : 'b')]: $event => xx = $event
["onUpdate:" + (foo === 'foo' ? 'a' : 'b')]: $event => xx = $event
}, null, 16), _createVNode(_resolveComponent("E"), {
[a()]: xx,
[a() + "Modifiers"]: {
"a": true
},
["onUpdate" + a()]: $event => xx = $event
["onUpdate:" + a()]: $event => xx = $event
}, null, 16), _createVNode(_resolveComponent("F"), {
[b.c]: xx,
[b.c + "Modifiers"]: {
"a": true
},
["onUpdate" + b.c]: $event => xx = $event
["onUpdate:" + b.c]: $event => xx = $event
}, null, 16)]);"
`;