diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index bfe222be78f748dfe6429776a32ce28eb90ab328..5fe5821ab88ce9c2efb1258b1ad0d99eee950022 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 5863d424008bb3b332c372426bc32087a8793cf9..1a0492a8c7d9e0852a4cf54394142a854867c6cf 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`) }