From 1cb152bdd686b99443cbaf7cfe14ce837f1009e9 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Tue, 23 Jul 2019 16:26:46 +0800 Subject: [PATCH] fix showToast returnValue --- packages/uni-app-plus-nvue/dist/uni.js | 18 ++++++++++++++++-- src/platforms/app-plus/service/api/ui/popup.js | 16 +++++++++------- src/platforms/app-plus/service/bridge.js | 2 +- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/packages/uni-app-plus-nvue/dist/uni.js b/packages/uni-app-plus-nvue/dist/uni.js index ed1e3f36f..369a8a058 100644 --- a/packages/uni-app-plus-nvue/dist/uni.js +++ b/packages/uni-app-plus-nvue/dist/uni.js @@ -2597,7 +2597,7 @@ function unpack (args) { } function invoke (...args) { - return UniServiceJSBridge.invoke(...args) + return UniServiceJSBridge.invokeCallbackHandler(...args) } function publish (...args) { @@ -6142,6 +6142,14 @@ let waitingTimeout; let toast = false; let toastTimeout; +function showLoading$1 (args) { + return showToast$1(args).replace('showToast', 'showLoading') +} + +function hideLoading () { + return hideToast().replace('hideToast', 'hideLoading') +} + function showToast$1 ({ title = '', icon = 'success', @@ -6169,7 +6177,9 @@ function showToast$1 ({ toastTimeout = setTimeout(() => { hideToast(); }, 2000); - return + return { + errMsg: 'showToast:ok' + } } console.warn('uni.showToast 传入的 "position" 值 "' + position + '" 无效'); } @@ -6454,6 +6464,8 @@ var appApi = /*#__PURE__*/Object.freeze({ startBeaconDiscovery: startBeaconDiscovery, stopBeaconDiscovery: stopBeaconDiscovery, makePhoneCall: makePhoneCall$1, + SCAN_ID: SCAN_ID, + SCAN_PATH: SCAN_PATH, scanCode: scanCode, getSystemInfo: getSystemInfo, vibrateLong: vibrateLong, @@ -6509,6 +6521,8 @@ var appApi = /*#__PURE__*/Object.freeze({ showNavigationBarLoading: showNavigationBarLoading, hideNavigationBarLoading: hideNavigationBarLoading, setNavigationBarColor: setNavigationBarColor$1, + showLoading: showLoading$1, + hideLoading: hideLoading, showToast: showToast$1, hideToast: hideToast, showModal: showModal$1, diff --git a/src/platforms/app-plus/service/api/ui/popup.js b/src/platforms/app-plus/service/api/ui/popup.js index 9d0d07578..f339ab6ae 100644 --- a/src/platforms/app-plus/service/api/ui/popup.js +++ b/src/platforms/app-plus/service/api/ui/popup.js @@ -7,15 +7,15 @@ let waitingTimeout let toast = false let toastTimeout -export function showLoading(args) { +export function showLoading (args) { return showToast(args).replace('showToast', 'showLoading') } -export function hideLoading() { +export function hideLoading () { return hideToast().replace('hideToast', 'hideLoading') } -export function showToast({ +export function showToast ({ title = '', icon = 'success', image = '', @@ -42,7 +42,9 @@ export function showToast({ toastTimeout = setTimeout(() => { hideToast() }, 2000) - return + return { + errMsg: 'showToast:ok' + } } console.warn('uni.showToast 传入的 "position" 值 "' + position + '" 无效') } @@ -104,7 +106,7 @@ export function showToast({ } } -export function hideToast() { +export function hideToast () { if (toast) { toastTimeout && clearTimeout(toastTimeout) plus.nativeUI.closeToast() @@ -120,7 +122,7 @@ export function hideToast() { errMsg: 'hideToast:ok' } } -export function showModal({ +export function showModal ({ title = '', content = '', showCancel = true, @@ -145,7 +147,7 @@ export function showModal({ } }, title, showCancel ? [cancelText, confirmText] : [confirmText]) } -export function showActionSheet({ +export function showActionSheet ({ itemList = [], itemColor = '#000000', title = '' diff --git a/src/platforms/app-plus/service/bridge.js b/src/platforms/app-plus/service/bridge.js index c610c28da..3fdc5d35e 100644 --- a/src/platforms/app-plus/service/bridge.js +++ b/src/platforms/app-plus/service/bridge.js @@ -7,7 +7,7 @@ export function unpack (args) { } export function invoke (...args) { - return UniServiceJSBridge.invoke(...args) + return UniServiceJSBridge.invokeCallbackHandler(...args) } export function publish (...args) { -- GitLab