fix(compiler-vapor): register event for v-model

This commit is contained in:
三咲智子 Kevin Deng 2024-02-23 13:20:14 +08:00
parent 26f29b2529
commit 88123e56d0
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
2 changed files with 13 additions and 13 deletions

View File

@ -7,7 +7,7 @@ const t0 = _template("<input>")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelText, () => _ctx.model, void 0, { lazy: true }]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -19,7 +19,7 @@ const t0 = _template("<input>")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelText, () => _ctx.model, void 0, { number: true }]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -31,7 +31,7 @@ const t0 = _template("<input>")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelText, () => _ctx.model, void 0, { trim: true }]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -43,7 +43,7 @@ const t0 = _template("<input type=\\"checkbox\\">")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelCheckbox, () => _ctx.model]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -55,7 +55,7 @@ const t0 = _template("<input>")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelDynamic, () => _ctx.model]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -67,7 +67,7 @@ const t0 = _template("<input type=\\"radio\\">")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelRadio, () => _ctx.model]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -79,7 +79,7 @@ const t0 = _template("<input type=\\"text\\">")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelText, () => _ctx.model]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -91,7 +91,7 @@ const t0 = _template("<select></select>")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelSelect, () => _ctx.model]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -103,7 +103,7 @@ const t0 = _template("<input>")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelText, () => _ctx.model]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -115,7 +115,7 @@ const t0 = _template("<textarea></textarea>")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelText, () => _ctx.model]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;
@ -127,7 +127,7 @@ const t0 = _template("<input>")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelDynamic, () => _ctx.model]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
_renderEffect(() => _setDynamicProps(n1, _ctx.obj))
return n1
}"
@ -140,7 +140,7 @@ const t0 = _template("<input>")
export function render(_ctx) {
const n1 = t0()
_withDirectives(n1, [[_vModelDynamic, () => _ctx.model]])
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
_on(n1, "update:modelValue", () => $event => (_ctx.model = $event))
return n1
}"
`;

View File

@ -18,7 +18,7 @@ export function genSetModelValue(
? [JSON.stringify(`update:${camelize(oper.key.content)}`)]
: ['`update:${', ...genExpression(oper.key, context), '}`']
const handler = [
(isTS ? `($event: any)` : `$event`) + ' => (',
`() => ${isTS ? `($event: any)` : `$event`} => (`,
...genExpression(oper.value, context, '$event'),
')',
]