From 0a51a6423825ffea8c38859bd4e1ac2a3852b3fc Mon Sep 17 00:00:00 2001 From: qiang Date: Tue, 14 Jul 2020 11:42:46 +0800 Subject: [PATCH] build runtime --- packages/uni-app-plus/dist/index.js | 25 +++++++++++---------- packages/uni-mp-alipay/dist/index.js | 25 +++++++++++---------- packages/uni-mp-baidu/dist/index.js | 25 +++++++++++---------- packages/uni-mp-qq/dist/index.js | 25 +++++++++++---------- packages/uni-mp-toutiao/dist/index.js | 25 +++++++++++---------- packages/uni-mp-weixin/dist/index.js | 25 +++++++++++---------- packages/uni-quickapp-webview/dist/index.js | 25 +++++++++++---------- 7 files changed, 91 insertions(+), 84 deletions(-) diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 6a0625f17..c29ae55ba 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -470,10 +470,6 @@ TODOS.forEach(function (name) { }); const getEmitter = (function () { - if (typeof getUniEmitter === 'function') { - /* eslint-disable no-undef */ - return getUniEmitter - } let Emitter; return function getUniEmitter () { if (!Emitter) { @@ -637,8 +633,8 @@ Component = function (options = {}) { const PAGE_EVENT_HOOKS = [ 'onPullDownRefresh', - 'onReachBottom', - 'onAddToFavorites', + 'onReachBottom', + 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', @@ -1073,6 +1069,15 @@ function isMatchEventType (eventType, optType) { ) } +function getContextVm (vm) { + let $parent = vm.$parent; + // 父组件是 scoped slots 或者其他自定义组件时继续查找 + while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) { + $parent = $parent.$parent; + } + return $parent && $parent.$parent +} + function handleEvent (event) { event = wrapper$2(event); @@ -1105,12 +1110,8 @@ function handleEvent (event) { const methodName = eventArray[0]; if (methodName) { let handlerCtx = this.$vm; - if ( - handlerCtx.$options.generic && - handlerCtx.$parent && - handlerCtx.$parent.$parent - ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots - handlerCtx = handlerCtx.$parent.$parent; + if (handlerCtx.$options.generic) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots + handlerCtx = getContextVm(handlerCtx) || handlerCtx; } if (methodName === '$emit') { handlerCtx.$emit.apply(handlerCtx, diff --git a/packages/uni-mp-alipay/dist/index.js b/packages/uni-mp-alipay/dist/index.js index b58100687..f4bfc5f99 100644 --- a/packages/uni-mp-alipay/dist/index.js +++ b/packages/uni-mp-alipay/dist/index.js @@ -972,10 +972,6 @@ var extraApi = /*#__PURE__*/Object.freeze({ }); const getEmitter = (function () { - if (typeof getUniEmitter === 'function') { - /* eslint-disable no-undef */ - return getUniEmitter - } let Emitter; return function getUniEmitter () { if (!Emitter) { @@ -1124,8 +1120,8 @@ var api = /*#__PURE__*/Object.freeze({ const PAGE_EVENT_HOOKS = [ 'onPullDownRefresh', - 'onReachBottom', - 'onAddToFavorites', + 'onReachBottom', + 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', @@ -1550,6 +1546,15 @@ function isMatchEventType (eventType, optType) { ) } +function getContextVm (vm) { + let $parent = vm.$parent; + // 父组件是 scoped slots 或者其他自定义组件时继续查找 + while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) { + $parent = $parent.$parent; + } + return $parent && $parent.$parent +} + function handleEvent (event) { event = wrapper$1(event); @@ -1582,12 +1587,8 @@ function handleEvent (event) { const methodName = eventArray[0]; if (methodName) { let handlerCtx = this.$vm; - if ( - handlerCtx.$options.generic && - handlerCtx.$parent && - handlerCtx.$parent.$parent - ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots - handlerCtx = handlerCtx.$parent.$parent; + if (handlerCtx.$options.generic) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots + handlerCtx = getContextVm(handlerCtx) || handlerCtx; } if (methodName === '$emit') { handlerCtx.$emit.apply(handlerCtx, diff --git a/packages/uni-mp-baidu/dist/index.js b/packages/uni-mp-baidu/dist/index.js index 662c9e82b..74b76fea6 100644 --- a/packages/uni-mp-baidu/dist/index.js +++ b/packages/uni-mp-baidu/dist/index.js @@ -650,10 +650,6 @@ var extraApi = /*#__PURE__*/Object.freeze({ }); const getEmitter = (function () { - if (typeof getUniEmitter === 'function') { - /* eslint-disable no-undef */ - return getUniEmitter - } let Emitter; return function getUniEmitter () { if (!Emitter) { @@ -753,8 +749,8 @@ Component = function (options = {}) { const PAGE_EVENT_HOOKS = [ 'onPullDownRefresh', - 'onReachBottom', - 'onAddToFavorites', + 'onReachBottom', + 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', @@ -1215,6 +1211,15 @@ function isMatchEventType (eventType, optType) { ) } +function getContextVm (vm) { + let $parent = vm.$parent; + // 父组件是 scoped slots 或者其他自定义组件时继续查找 + while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) { + $parent = $parent.$parent; + } + return $parent && $parent.$parent +} + function handleEvent (event) { event = wrapper$1(event); @@ -1247,12 +1252,8 @@ function handleEvent (event) { const methodName = eventArray[0]; if (methodName) { let handlerCtx = this.$vm; - if ( - handlerCtx.$options.generic && - handlerCtx.$parent && - handlerCtx.$parent.$parent - ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots - handlerCtx = handlerCtx.$parent.$parent; + if (handlerCtx.$options.generic) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots + handlerCtx = getContextVm(handlerCtx) || handlerCtx; } if (methodName === '$emit') { handlerCtx.$emit.apply(handlerCtx, diff --git a/packages/uni-mp-qq/dist/index.js b/packages/uni-mp-qq/dist/index.js index 8bf2651ef..bd2aad7b2 100644 --- a/packages/uni-mp-qq/dist/index.js +++ b/packages/uni-mp-qq/dist/index.js @@ -611,10 +611,6 @@ var extraApi = /*#__PURE__*/Object.freeze({ }); const getEmitter = (function () { - if (typeof getUniEmitter === 'function') { - /* eslint-disable no-undef */ - return getUniEmitter - } let Emitter; return function getUniEmitter () { if (!Emitter) { @@ -695,8 +691,8 @@ Component = function (options = {}) { const PAGE_EVENT_HOOKS = [ 'onPullDownRefresh', - 'onReachBottom', - 'onAddToFavorites', + 'onReachBottom', + 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', @@ -1131,6 +1127,15 @@ function isMatchEventType (eventType, optType) { ) } +function getContextVm (vm) { + let $parent = vm.$parent; + // 父组件是 scoped slots 或者其他自定义组件时继续查找 + while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) { + $parent = $parent.$parent; + } + return $parent && $parent.$parent +} + function handleEvent (event) { event = wrapper$1(event); @@ -1163,12 +1168,8 @@ function handleEvent (event) { const methodName = eventArray[0]; if (methodName) { let handlerCtx = this.$vm; - if ( - handlerCtx.$options.generic && - handlerCtx.$parent && - handlerCtx.$parent.$parent - ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots - handlerCtx = handlerCtx.$parent.$parent; + if (handlerCtx.$options.generic) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots + handlerCtx = getContextVm(handlerCtx) || handlerCtx; } if (methodName === '$emit') { handlerCtx.$emit.apply(handlerCtx, diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index b85d9bb24..e2cea6b7c 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -703,10 +703,6 @@ var extraApi = /*#__PURE__*/Object.freeze({ }); const getEmitter = (function () { - if (typeof getUniEmitter === 'function') { - /* eslint-disable no-undef */ - return getUniEmitter - } let Emitter; return function getUniEmitter () { if (!Emitter) { @@ -787,8 +783,8 @@ Component = function (options = {}) { const PAGE_EVENT_HOOKS = [ 'onPullDownRefresh', - 'onReachBottom', - 'onAddToFavorites', + 'onReachBottom', + 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', @@ -1223,6 +1219,15 @@ function isMatchEventType (eventType, optType) { ) } +function getContextVm (vm) { + let $parent = vm.$parent; + // 父组件是 scoped slots 或者其他自定义组件时继续查找 + while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) { + $parent = $parent.$parent; + } + return $parent && $parent.$parent +} + function handleEvent (event) { event = wrapper$1(event); @@ -1255,12 +1260,8 @@ function handleEvent (event) { const methodName = eventArray[0]; if (methodName) { let handlerCtx = this.$vm; - if ( - handlerCtx.$options.generic && - handlerCtx.$parent && - handlerCtx.$parent.$parent - ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots - handlerCtx = handlerCtx.$parent.$parent; + if (handlerCtx.$options.generic) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots + handlerCtx = getContextVm(handlerCtx) || handlerCtx; } if (methodName === '$emit') { handlerCtx.$emit.apply(handlerCtx, diff --git a/packages/uni-mp-weixin/dist/index.js b/packages/uni-mp-weixin/dist/index.js index 17b2b6602..6257f15b6 100644 --- a/packages/uni-mp-weixin/dist/index.js +++ b/packages/uni-mp-weixin/dist/index.js @@ -563,10 +563,6 @@ var extraApi = /*#__PURE__*/Object.freeze({ }); const getEmitter = (function () { - if (typeof getUniEmitter === 'function') { - /* eslint-disable no-undef */ - return getUniEmitter - } let Emitter; return function getUniEmitter () { if (!Emitter) { @@ -652,8 +648,8 @@ Component = function (options = {}) { const PAGE_EVENT_HOOKS = [ 'onPullDownRefresh', - 'onReachBottom', - 'onAddToFavorites', + 'onReachBottom', + 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', @@ -1088,6 +1084,15 @@ function isMatchEventType (eventType, optType) { ) } +function getContextVm (vm) { + let $parent = vm.$parent; + // 父组件是 scoped slots 或者其他自定义组件时继续查找 + while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) { + $parent = $parent.$parent; + } + return $parent && $parent.$parent +} + function handleEvent (event) { event = wrapper$1(event); @@ -1120,12 +1125,8 @@ function handleEvent (event) { const methodName = eventArray[0]; if (methodName) { let handlerCtx = this.$vm; - if ( - handlerCtx.$options.generic && - handlerCtx.$parent && - handlerCtx.$parent.$parent - ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots - handlerCtx = handlerCtx.$parent.$parent; + if (handlerCtx.$options.generic) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots + handlerCtx = getContextVm(handlerCtx) || handlerCtx; } if (methodName === '$emit') { handlerCtx.$emit.apply(handlerCtx, diff --git a/packages/uni-quickapp-webview/dist/index.js b/packages/uni-quickapp-webview/dist/index.js index 43dbdb56d..22e115daf 100644 --- a/packages/uni-quickapp-webview/dist/index.js +++ b/packages/uni-quickapp-webview/dist/index.js @@ -553,10 +553,6 @@ var extraApi = /*#__PURE__*/Object.freeze({ }); const getEmitter = (function () { - if (typeof getUniEmitter === 'function') { - /* eslint-disable no-undef */ - return getUniEmitter - } let Emitter; return function getUniEmitter () { if (!Emitter) { @@ -637,8 +633,8 @@ Component = function (options = {}) { const PAGE_EVENT_HOOKS = [ 'onPullDownRefresh', - 'onReachBottom', - 'onAddToFavorites', + 'onReachBottom', + 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', @@ -1073,6 +1069,15 @@ function isMatchEventType (eventType, optType) { ) } +function getContextVm (vm) { + let $parent = vm.$parent; + // 父组件是 scoped slots 或者其他自定义组件时继续查找 + while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) { + $parent = $parent.$parent; + } + return $parent && $parent.$parent +} + function handleEvent (event) { event = wrapper$1(event); @@ -1105,12 +1110,8 @@ function handleEvent (event) { const methodName = eventArray[0]; if (methodName) { let handlerCtx = this.$vm; - if ( - handlerCtx.$options.generic && - handlerCtx.$parent && - handlerCtx.$parent.$parent - ) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots - handlerCtx = handlerCtx.$parent.$parent; + if (handlerCtx.$options.generic) { // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots + handlerCtx = getContextVm(handlerCtx) || handlerCtx; } if (methodName === '$emit') { handlerCtx.$emit.apply(handlerCtx, -- GitLab