Bläddra i källkod

fix(compiler-sfc): Resolve object expression parsing errors in `v-on` (#12862)

webfansplz 2 år sedan
förälder
incheckning
b8c8b3fc7a
1 ändrade filer med 1 tillägg och 1 borttagningar
  1. 1 1
      packages/compiler-sfc/src/compileScript.ts

+ 1 - 1
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) {