Skip to content

Commit a07a633

Browse files
committed
fix: syntax error when v-on contains objects
1 parent 8772a01 commit a07a633

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/compiler-sfc/src/compileScript.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,11 @@ function processExp(exp: string, dir?: string): string {
21352135
if (dir === 'slot') {
21362136
exp = `(${exp})=>{}`
21372137
} else if (dir === 'on') {
2138-
exp = `()=>{${exp}}`
2138+
if (/^\{.*\}$/.test(exp.trim())) {
2139+
exp = `()=>(${exp})`
2140+
} else {
2141+
exp = `()=>{${exp}}`
2142+
}
21392143
} else if (dir === 'for') {
21402144
const inMatch = exp.match(forAliasRE)
21412145
if (inMatch) {

0 commit comments

Comments
 (0)