diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 0547d3a2053961bc67cd3482c93b16592f125b8b..2edd4e894aea35c4a434d940e58386ab647e5870 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -1079,6 +1079,18 @@ 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 } const handler = handlerCtx[methodName]; if (!isFn(handler)) { diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index eaceec18684a0e47b859ec8a4da0723fd94ceeaa..4fca9f7392a0fbab254303787f5f3d3e7010bf93 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -1471,6 +1471,18 @@ 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 } const handler = handlerCtx[methodName]; if (!isFn(handler)) { @@ -1665,7 +1677,7 @@ const customizeRE = /:/g; const customize = cached((str) => { return camelize(str.replace(customizeRE, '-')) -}); +}); const isComponent2 = my.canIUse('component2'); @@ -1763,7 +1775,7 @@ function handleRef (ref) { if (refName) { this.$vm.$refs[refName] = ref.$vm || ref; } else if (refInForName) { - this.$vm.$refs[refInForName] = [ref.$vm || ref]; + (this.$vm.$refs[refInForName] || (this.$vm.$refs[refInForName] = [])).push(ref.$vm || ref); } } diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index 81a9ad4803a26c93054f90cc840b1a8267c7a5db..ed18e1bb7a3f039f80eaf1427bffa2e974724a03 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -1216,6 +1216,18 @@ 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 } const handler = handlerCtx[methodName]; if (!isFn(handler)) { @@ -1509,9 +1521,9 @@ function parseComponent (vueOptions) { initRelation }); - // 关于百度小程序新生命周期(2.0)的说明(组件作为页面时): + // 关于百度小程序生命周期的说明(组件作为页面时): // lifetimes:attached --> methods:onShow --> methods:onLoad --> methods:onReady - // 这里在新生命周期强制将onShow挪到onLoad之后触发,另外一处修改在page-parser.js + // 这里在强制将onShow挪到onLoad之后触发,另外一处修改在page-parser.js const oldAttached = componentOptions.lifetimes.attached; componentOptions.lifetimes.attached = function attached () { oldAttached.call(this); @@ -1596,12 +1608,12 @@ function parsePage (vuePageOptions) { initRelation }); - const newLifecycle = swan.canIUse('lifecycle-2-0'); - - // 纠正百度小程序新生命周期(2.0)methods:onShow在methods:onLoad之前触发的问题 - if (newLifecycle) { - delete pageOptions.methods.onShow; - } + // 纠正百度小程序生命周期methods:onShow在methods:onLoad之前触发的问题 + pageOptions.methods.onShow = function onShow () { + if (this.$vm && this.$vm.$mp.query) { + this.$vm.__call_hook('onShow'); + } + }; pageOptions.methods.onLoad = function onLoad (args) { // 百度 onLoad 在 attached 之前触发,先存储 args, 在 attached 里边触发 onLoad diff --git a/packages/uni-mp-qq/dist/index.js b/packages/uni-mp-qq/dist/index.js index 50e52986beb6f6da659fbcaed8a40af716df3ba1..edfd191af674af3c66cac068387b71d24aa896df 100644 --- a/packages/uni-mp-qq/dist/index.js +++ b/packages/uni-mp-qq/dist/index.js @@ -1134,6 +1134,18 @@ 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 } const handler = handlerCtx[methodName]; if (!isFn(handler)) { diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index 03827351fb09c745ecc283ff36cf83630885457d..9f7142b8aa3db1a2210324f00769dab12d8b767e 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -1226,6 +1226,18 @@ 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 } const handler = handlerCtx[methodName]; if (!isFn(handler)) { diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index bfe222be78f748dfe6429776a32ce28eb90ab328..107520ea4321ee4a52648011380acc1be0a43870 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -1074,6 +1074,18 @@ 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 } const handler = handlerCtx[methodName]; if (!isFn(handler)) {