提交 15316102 编写于 作者: Q qiang 提交者: 折腾笔记

fix(mp-jd): mpInstance.triggerEvent

上级 238086e3
...@@ -5827,7 +5827,7 @@ function internalMixin(Vue) { ...@@ -5827,7 +5827,7 @@ function internalMixin(Vue) {
Vue.prototype.$emit = function(event) { Vue.prototype.$emit = function(event) {
if (this.$scope && event) { if (this.$scope && event) {
this.$scope['triggerEvent'](event, { (this.$scope['_triggerEvent'] || this.$scope['triggerEvent'])(event, {
__args__: toArray(arguments, 1) __args__: toArray(arguments, 1)
}); });
} }
......
...@@ -14,9 +14,15 @@ const customize = cached((str) => { ...@@ -14,9 +14,15 @@ const customize = cached((str) => {
function initTriggerEvent (mpInstance) { function initTriggerEvent (mpInstance) {
const oldTriggerEvent = mpInstance.triggerEvent const oldTriggerEvent = mpInstance.triggerEvent
mpInstance.triggerEvent = function (event, ...args) { const newTriggerEvent = function (event, ...args) {
return oldTriggerEvent.apply(mpInstance, [customize(event), ...args]) return oldTriggerEvent.apply(mpInstance, [customize(event), ...args])
} }
try {
// 京东小程序 triggerEvent 为只读
mpInstance.triggerEvent = newTriggerEvent
} catch (error) {
mpInstance._triggerEvent = newTriggerEvent
}
} }
function initHook (name, options, isComponent) { function initHook (name, options, isComponent) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册