From c006ddc7d7486b6ca93d94474e5dc0292d835d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=98=8E=E5=AF=8C?= <212149997@qq.com> Date: Sat, 2 Nov 2024 15:54:10 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/use-loading-store.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/store/modules/use-loading-store.ts b/src/store/modules/use-loading-store.ts index b8a8416..9261d2b 100644 --- a/src/store/modules/use-loading-store.ts +++ b/src/store/modules/use-loading-store.ts @@ -10,6 +10,10 @@ type Action = { hideLoading: Fn; }; +/** + * 场景: + * 并发请求,响应有快有慢,第一个请求完成后就给loading设置false结束了,实际我们要最后一个请求完成之后才结束loading,所以需要计数。 + */ export const useLoadingStore = create((set) => ({ count: 0, // 用于记录并发请求的数量 isLoading: false,