From e7258b3726a4402312767cac0d0dd7cb2717f648 Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 24 Jun 2020 16:17:57 +0800 Subject: [PATCH] build v3 --- packages/uni-app-plus/dist/index.v3.js | 104 +++++++++++-------------- 1 file changed, 46 insertions(+), 58 deletions(-) diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index 19424029..3e115401 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -8486,7 +8486,9 @@ var serviceContext = (function () { return } - uni.hideToast(); // 后退时,关闭 toast,loading + // 后退时,关闭 toast,loading + uni.hideToast(); + uni.hideLoading(); if (currentPage.$page.meta.isQuit) { quit(); @@ -9322,17 +9324,16 @@ var serviceContext = (function () { } } - let waiting; - let waitingTimeout; - let toast = false; - let toastTimeout; + let toast; + let toastType; + let timeout; function showLoading$1 (args) { - return callApiSync(showToast$1, args, 'showToast', 'showLoading') + return callApiSync(showToast$1, Object.assign({}, args, { type: 'loading' }), 'showToast', 'showLoading') } function hideLoading () { - return callApiSync(hideToast, Object.create(null), 'hideToast', 'hideLoading') + return callApiSync(hide, 'loading', 'hide', 'hideLoading') } function showToast$1 ({ @@ -9341,41 +9342,18 @@ var serviceContext = (function () { image = '', duration = 1500, mask = false, - position = '' + position = '', + type = 'toast' } = {}) { - if (position) { - if (toast) { - toastTimeout && clearTimeout(toastTimeout); - plus.nativeUI.closeToast(); - } - if (waiting) { - waitingTimeout && clearTimeout(waitingTimeout); - waiting.close(); - } - if (~['top', 'center', 'bottom'].indexOf(position)) { - plus.nativeUI.toast(title, { - verticalAlign: position - }); - toast = true; - toastTimeout = setTimeout(() => { - hideToast(); - }, 2000); - return { - errMsg: 'showToast:ok' - } - } - console.warn('uni.showToast 传入的 "position" 值 "' + position + '" 无效'); - } - - if (duration) { - if (waiting) { - waitingTimeout && clearTimeout(waitingTimeout); - waiting.close(); - } - if (toast) { - toastTimeout && clearTimeout(toastTimeout); - plus.nativeUI.closeToast(); - } + hide(null); + toastType = type; + if (['top', 'center', 'bottom'].includes(position)) { + // 仅可以关闭 richtext 类型,但 iOS 部分情况换行显示有问题 + plus.nativeUI.toast(title, { + verticalAlign: position + }); + toast = true; + } else { if (icon && !~['success', 'loading', 'none'].indexOf(icon)) { icon = 'success'; } @@ -9409,35 +9387,42 @@ var serviceContext = (function () { height: '55px', icon: '__uniappsuccess.png', interval: duration - }; } } - waiting = plus.nativeUI.showWaiting(title, waitingOptions); - waitingTimeout = setTimeout(() => { - hideToast(); - }, duration); + toast = plus.nativeUI.showWaiting(title, waitingOptions); } + + timeout = setTimeout(() => { + hide(null); + }, duration); return { errMsg: 'showToast:ok' } } function hideToast () { - if (toast) { - toastTimeout && clearTimeout(toastTimeout); - plus.nativeUI.closeToast(); - toast = false; + return callApiSync(hide, 'toast', 'hide', 'hideToast') + } + + function hide (type = 'toast') { + if (type && type !== toastType) { + return + } + if (timeout) { + clearTimeout(timeout); + timeout = null; } - if (waiting) { - waitingTimeout && clearTimeout(waitingTimeout); - waiting.close(); - waiting = null; - waitingTimeout = null; + if (toast === true) { + plus.nativeUI.closeToast(); + } else if (toast && toast.close) { + toast.close(); } + toast = null; + toastType = null; return { - errMsg: 'hideToast:ok' + errMsg: 'hide:ok' } } function showModal$1 ({ @@ -9979,6 +9964,7 @@ var serviceContext = (function () { hideLoading: hideLoading, showToast: showToast$1, hideToast: hideToast, + hide: hide, showModal: showModal$1, showActionSheet: showActionSheet$1, setTabBarBadge: setTabBarBadge$2, @@ -14015,7 +14001,8 @@ var serviceContext = (function () { 'onLaunch', 'onShow', 'onHide', - 'onUniNViewMessage', + 'onUniNViewMessage', + 'onPageNotFound', 'onError', // Page 'onLoad', @@ -14223,7 +14210,8 @@ var serviceContext = (function () { globalEvent.addEventListener('launchApp', () => { if (process.env.NODE_ENV !== 'production') { console.log('[uni-app] launchApp'); - } + } + plus.updateConfigInfo && plus.updateConfigInfo(); registerApp(this); oldMount.call(this, el, hydrating); }); -- GitLab