From 979bc5d5616d8f43681251a93a546008c83a4683 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期五, 10 四月 2026 10:18:31 +0800
Subject: [PATCH] #
---
rsf-design/src/utils/ui/loading.js | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/rsf-design/src/utils/ui/loading.js b/rsf-design/src/utils/ui/loading.js
index 85932db..e877c0e 100644
--- a/rsf-design/src/utils/ui/loading.js
+++ b/rsf-design/src/utils/ui/loading.js
@@ -13,18 +13,26 @@
customClass: 'art-loading-fix'
}
let loadingInstance = null
+let loadingTimer = null
+const DEFAULT_LOADING_DELAY = 180
const loadingService = {
/**
* 鏄剧ず loading
* @returns 鍏抽棴 loading 鐨勫嚱鏁�
*/
showLoading() {
- if (!loadingInstance) {
- const config = {
- ...DEFAULT_LOADING_CONFIG,
- background: getLoadingBackground()
- }
- loadingInstance = ElLoading.service(config)
+ if (!loadingInstance && !loadingTimer) {
+ loadingTimer = setTimeout(() => {
+ loadingTimer = null
+ if (loadingInstance) {
+ return
+ }
+ const config = {
+ ...DEFAULT_LOADING_CONFIG,
+ background: getLoadingBackground()
+ }
+ loadingInstance = ElLoading.service(config)
+ }, DEFAULT_LOADING_DELAY)
}
return () => this.hideLoading()
},
@@ -32,6 +40,10 @@
* 闅愯棌 loading
*/
hideLoading() {
+ if (loadingTimer) {
+ clearTimeout(loadingTimer)
+ loadingTimer = null
+ }
if (loadingInstance) {
loadingInstance.close()
loadingInstance = null
--
Gitblit v1.9.1