Skip to content

Commit

Permalink
docs: 添加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
huangmingfu committed Nov 2, 2024
1 parent 98129bf commit c006ddc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/store/modules/use-loading-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ type Action = {
hideLoading: Fn;
};

/**
* 场景:
* 并发请求,响应有快有慢,第一个请求完成后就给loading设置false结束了,实际我们要最后一个请求完成之后才结束loading,所以需要计数。
*/
export const useLoadingStore = create<State & Action>((set) => ({
count: 0, // 用于记录并发请求的数量
isLoading: false,
Expand Down

0 comments on commit c006ddc

Please sign in to comment.