From c8dc511560c58492885dadc3409e9906aa0a405a Mon Sep 17 00:00:00 2001 From: claw_bot Date: Fri, 13 Mar 2026 03:24:10 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dapi.js=E4=B8=ADtoast?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - uni.$u.toast.loading/hide 改为 uni.showLoading/hideLoading - uni.$u.toast.error 改为 uni.showToast - uview-plus的toast API与uview-ui不同 --- utils/api.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/api.js b/utils/api.js index 3417675..feceb49 100755 --- a/utils/api.js +++ b/utils/api.js @@ -17,7 +17,7 @@ let loginLock = null; let loadingCount = 0; const showLoading = () => { if (loadingCount === 0) { - uni.$u.toast.loading('加载中...'); + uni.showLoading({ title: '加载中...', mask: true }); } loadingCount++; }; @@ -25,7 +25,7 @@ const hideLoading = () => { loadingCount--; if (loadingCount <= 0) { loadingCount = 0; - uni.$u.toast.hide(); + uni.hideLoading(); } }; @@ -196,7 +196,7 @@ const requestWithRetry = async (url, method = 'GET', data = {}, headers = {}, re return await requestWithRetry(url, method, data, headers, retryCount + 1); } else { console.error('❌ 达到最大重试次数'); - uni.$u.toast.error('系统异常,请稍后重试'); + uni.showToast({ title: '系统异常,请稍后重试', icon: 'none' }); throw new Error('登录已过期,重试次数超限'); } } else {