From 5fe7c5d3dad96d0cff41890c20367f0901855c76 Mon Sep 17 00:00:00 2001 From: qiang Date: Tue, 15 Dec 2020 17:44:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=B9=B3=E5=8F=B0=E4=BA=8B=E4=BB=B6=E5=86=85=20argume?= =?UTF-8?q?nts=20=E5=A4=9A=E4=BD=99=E5=8F=82=E6=95=B0=20fixed=20#2270?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/runtime/wrapper/util.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/runtime/wrapper/util.js b/src/core/runtime/wrapper/util.js index 007271198..3b6fdf7ab 100644 --- a/src/core/runtime/wrapper/util.js +++ b/src/core/runtime/wrapper/util.js @@ -542,7 +542,7 @@ export function handleEvent (event) { } handler.once = true } - const params = processEventArgs( + let params = processEventArgs( this.$vm, event, eventArray[1], @@ -550,9 +550,13 @@ export function handleEvent (event) { isCustom, methodName ) + params = Array.isArray(params) ? params : [] // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据 - // eslint-disable-next-line no-sparse-arrays - ret.push(handler.apply(handlerCtx, (Array.isArray(params) ? params : []).concat([, , , , , , , , , , event]))) + if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) { + // eslint-disable-next-line no-sparse-arrays + params = params.concat([, , , , , , , , , , event]) + } + ret.push(handler.apply(handlerCtx, params)) } }) } -- GitLab