From 718374e4dafdd35aa805db4cc613cb0673d881e8 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Tue, 19 Nov 2019 16:51:29 +0800 Subject: [PATCH] npm run build:runtime --- packages/uni-app-plus/dist/index.js | 12 ++++++++++++ packages/uni-mp-alipay/dist/index.js | 16 +++++++++++++-- packages/uni-mp-baidu/dist/index.js | 28 +++++++++++++++++++-------- packages/uni-mp-qq/dist/index.js | 12 ++++++++++++ packages/uni-mp-toutiao/dist/index.js | 12 ++++++++++++ packages/uni-mp-weixin/dist/index.js | 12 ++++++++++++ 6 files changed, 82 insertions(+), 10 deletions(-) diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 0547d3a20..2edd4e894 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 eaceec186..4fca9f739 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 81a9ad480..ed18e1bb7 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 50e52986b..edfd191af 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 03827351f..9f7142b8a 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 bfe222be7..107520ea4 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)) { -- GitLab