瀏覽代碼

fix(compiler-sfc): fix expression check for v-on with object literal value (#6652)

fix #6650
fix #6674
Travis 3 年之前
父節點
當前提交
6958ec1b37
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      packages/compiler-sfc/src/compileScript.ts

+ 1 - 1
packages/compiler-sfc/src/compileScript.ts

@@ -2135,7 +2135,7 @@ function processExp(exp: string, 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) {