From 8712c8719475e620299800917f300f09702e873c Mon Sep 17 00:00:00 2001 From: qiang Date: Mon, 13 Apr 2020 18:19:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=B9=B3=E5=8F=B0=20map=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=BA=8B=E4=BB=B6=E4=B8=AD=E6=97=A0=E6=B3=95=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E8=8E=B7=E5=8F=96=20markerId=20=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/runtime/wrapper/util.js | 30 +++++++++++-------- .../mp-alipay/runtime/wrapper/util.js | 11 +++++-- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/core/runtime/wrapper/util.js b/src/core/runtime/wrapper/util.js index ad0d83de..94ffa9b4 100644 --- a/src/core/runtime/wrapper/util.js +++ b/src/core/runtime/wrapper/util.js @@ -291,6 +291,10 @@ function wrapper (event) { event.detail = {} } + if (!('markerId' in event.detail) && 'markerId' in event) { + event.detail.markerId = event.markerId + } + if (__PLATFORM__ === 'mp-baidu') { // mp-baidu,checked=>value if ( isPlainObject(event.detail) && @@ -485,18 +489,18 @@ export function handleEvent (event) { handlerCtx.$parent.$parent ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots handlerCtx = handlerCtx.$parent.$parent - } - if (methodName === '$emit') { - handlerCtx.$emit.apply(handlerCtx, - processEventArgs( - this.$vm, - event, - eventArray[1], - eventArray[2], - isCustom, - methodName - )) - return + } + if (methodName === '$emit') { + handlerCtx.$emit.apply(handlerCtx, + processEventArgs( + this.$vm, + event, + eventArray[1], + eventArray[2], + isCustom, + methodName + )) + return } const handler = handlerCtx[methodName] if (!isFn(handler)) { @@ -528,4 +532,4 @@ export function handleEvent (event) { ) { return ret[0] } -} +} diff --git a/src/platforms/mp-alipay/runtime/wrapper/util.js b/src/platforms/mp-alipay/runtime/wrapper/util.js index c1f5083c..69d91c48 100644 --- a/src/platforms/mp-alipay/runtime/wrapper/util.js +++ b/src/platforms/mp-alipay/runtime/wrapper/util.js @@ -1,7 +1,8 @@ import { isFn, cached, - camelize + camelize, + hasOwn } from 'uni-shared' import { @@ -58,6 +59,12 @@ export function initSpecialMethods (mpInstance) { specialMethods.forEach(method => { if (isFn(mpInstance.$vm[method])) { mpInstance[method] = function (event) { + if (!hasOwn(event, 'detail')) { + event.detail = {} + } + if (!('markerId' in event.detail) && 'markerId' in event) { + event.detail.markerId = event.markerId + } // TODO normalizeEvent mpInstance.$vm[method](event) } @@ -179,4 +186,4 @@ export const handleLink = (function () { // 支付宝通过 didMount 来实现,先子后父,故等父 ready 之后,统一初始化 (this._$childVues || (this._$childVues = [])).unshift(detail) } -})() +})() -- GitLab