From 2d4096c46651ea14b6c9a637bcd2f8952499fbe2 Mon Sep 17 00:00:00 2001 From: X1627315083 <1627315083@qq.com> Date: Thu, 23 Oct 2025 14:14:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=B1=80loding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index cd59ec6..99aae49 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -4,6 +4,7 @@ import { useUserInfoStore } from '@/stores/modules/userInfo' const store = useUserInfoStore() import { getLocal } from '@/utils/local' import router from '@/router/index' +import { useOverallStore } from '@/stores' // 创建axios实例 @@ -152,22 +153,18 @@ function removePending(config: any) { } } // ----------------------------------loading的函数------------------------------- -const LoadingInstance: { _target: any; _count: number } = { - _target: null, // 保存Loading实例 +const LoadingInstance: { _count: number } = { _count: 0 } function openLoading(loadingDom: any) { - LoadingInstance._target = showNotify({ - message: '数据正在加载中', - background: 'rgba(25, 32, 53, 1)' - }) + useOverallStore().setLoading(true) } function closeLoading() { if (LoadingInstance._count > 0) LoadingInstance._count-- if (LoadingInstance._count === 0) { - LoadingInstance._target?.close() - LoadingInstance._target = null + useOverallStore().setLoading(false) } + } export default service