From 89e0e24a4ae191314acfdba88add6e49975277c0 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Fri, 15 Nov 2019 15:15:15 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E7=AB=AF=E4=B8=8D=E8=83=BD=E7=9B=B4=E6=8E=A5=E5=9C=A8?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E5=86=85=E4=BD=BF=E7=94=A8$emit=E7=9A=84Bug?= =?UTF-8?q?=20askID:82865?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-mp-weixin/dist/index.js | 14 +++++++++++++- src/core/runtime/wrapper/util.js | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index bfe222be78..5fe5821ab8 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -1075,7 +1075,19 @@ function handleEvent (event) { ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots handlerCtx = handlerCtx.$parent.$parent; } - const handler = handlerCtx[methodName]; + const handler = handlerCtx[methodName]; + if (methodName === '$emit') { + handlerCtx.$emit.apply(handlerCtx, + processEventArgs( + this.$vm, + event, + eventArray[1], + eventArray[2], + isCustom, + methodName + )); + return + } if (!isFn(handler)) { throw new Error(` _vm.${methodName} is not a function`) } diff --git a/src/core/runtime/wrapper/util.js b/src/core/runtime/wrapper/util.js index 5863d42400..1a0492a8c7 100644 --- a/src/core/runtime/wrapper/util.js +++ b/src/core/runtime/wrapper/util.js @@ -486,7 +486,19 @@ export function handleEvent (event) { ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots handlerCtx = handlerCtx.$parent.$parent } - const handler = handlerCtx[methodName] + const handler = handlerCtx[methodName] + if (methodName === '$emit') { + handlerCtx.$emit.apply(handlerCtx, + processEventArgs( + this.$vm, + event, + eventArray[1], + eventArray[2], + isCustom, + methodName + )) + return + } if (!isFn(handler)) { throw new Error(` _vm.${methodName} is not a function`) } -- GitLab