diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index d83a2c462c10d9690b0af52936649ca789a33d3f..e50cc4863c9825211ca7e6699e91ea8bc654a062 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -509,24 +509,26 @@ function handleEvent (event) { if (eventsArray && eventType === type) { eventsArray.forEach(eventArray => { const methodName = eventArray[0]; - const handler = this.$vm[methodName]; - if (!isFn(handler)) { - throw new Error(` _vm.${methodName} is not a function`) - } - if (isOnce) { - if (handler.once) { - return + if (methodName) { + const handler = this.$vm[methodName]; + if (!isFn(handler)) { + throw new Error(` _vm.${methodName} is not a function`) + } + if (isOnce) { + if (handler.once) { + return + } + handler.once = true; } - handler.once = true; + handler.apply(this.$vm, processEventArgs( + this.$vm, + event, + eventArray[1], + eventArray[2], + isCustom, + methodName + )); } - handler.apply(this.$vm, processEventArgs( - this.$vm, - event, - eventArray[1], - eventArray[2], - isCustom, - methodName - )); }); } }); diff --git a/packages/uni-mp-weixin/package.json b/packages/uni-mp-weixin/package.json index 678be06e1f0f3568a8d01819d9c35c07cf62a553..ee01b7a8273ec9013e8868bb031319ad9bc04e4d 100644 --- a/packages/uni-mp-weixin/package.json +++ b/packages/uni-mp-weixin/package.json @@ -1,6 +1,6 @@ { "name": "@dcloudio/uni-mp-weixin", - "version": "0.0.925", + "version": "0.0.926", "description": "uni-app mp-weixin", "main": "dist/index.js", "scripts": { diff --git a/src/core/runtime/wrapper/util.js b/src/core/runtime/wrapper/util.js index 2da8dd97b3fa486c12fd317b78f7039d49cd99d4..ccdc61dc93c2bb99f70bdb35f24f27d37ea10913 100644 --- a/src/core/runtime/wrapper/util.js +++ b/src/core/runtime/wrapper/util.js @@ -252,24 +252,26 @@ export function handleEvent (event) { if (eventsArray && eventType === type) { eventsArray.forEach(eventArray => { const methodName = eventArray[0] - const handler = this.$vm[methodName] - if (!isFn(handler)) { - throw new Error(` _vm.${methodName} is not a function`) - } - if (isOnce) { - if (handler.once) { - return + if (methodName) { + const handler = this.$vm[methodName] + if (!isFn(handler)) { + throw new Error(` _vm.${methodName} is not a function`) + } + if (isOnce) { + if (handler.once) { + return + } + handler.once = true } - handler.once = true + handler.apply(this.$vm, processEventArgs( + this.$vm, + event, + eventArray[1], + eventArray[2], + isCustom, + methodName + )) } - handler.apply(this.$vm, processEventArgs( - this.$vm, - event, - eventArray[1], - eventArray[2], - isCustom, - methodName - )) }) } })