From b8c8b3fc7a211744fdabd237a1a986a1f80b7c43 Mon Sep 17 00:00:00 2001 From: webfansplz <308241863@qq.com> Date: Mon, 23 Oct 2023 15:08:58 +0800 Subject: [PATCH] fix(compiler-sfc): Resolve object expression parsing errors in `v-on` (#12862) --- packages/compiler-sfc/src/compileScript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 719b53592..8039b41e1 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -1841,7 +1841,7 @@ function processExp(exp: string, isTS: boolean, dir?: string): string { if (dir === 'slot') { exp = `(${exp})=>{}` } else if (dir === 'on') { - exp = `()=>{${exp}}` + exp = `()=>{return ${exp}}` } else if (dir === 'for') { const inMatch = exp.match(forAliasRE) if (inMatch) {