Skip to content

Commit ebac185

Browse files
committed
fix(language-core): do not generate event for v-model with dynamic arg
1 parent 27f9627 commit ebac185

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/language-core/lib/codegen/template/elementEvents.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ export function* generateElementEvents(
2525
if (
2626
prop.type === CompilerDOM.NodeTypes.DIRECTIVE
2727
&& (
28-
prop.name === 'model'
29-
|| prop.name === 'on'
30-
&& prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
31-
&& !prop.arg.loc.source.startsWith('[')
32-
&& !prop.arg.loc.source.endsWith(']')
28+
prop.name === 'on' && (prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic)
29+
|| prop.name === 'model' && (!prop.arg || prop.arg.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic)
3330
)
3431
) {
3532
ctx.currentComponent!.used = true;
@@ -190,7 +187,7 @@ export function* generateModelEventExpression(
190187
prop.exp.content,
191188
prop.exp.loc.start.offset,
192189
prop.exp.loc
193-
)
190+
);
194191
yield ` = $event)`;
195192
}
196193
else {

0 commit comments

Comments
 (0)