zmc
2023-11-22 ab5ba1cb04581f55b82e6474452adeb239b9ba44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 加载状态的逻辑管理
 
import { defineStore } from 'pinia'
 
export const useLoadingStore = defineStore('loading', {
  state: () => {
    return {
      loadingStatus: []
    }
  },
  actions: {
    clearLoading() {
      this.loadingStatus.forEach(l => {
        if (typeof l === 'function') {
          l()
        }
      });
      if (this.loadingStatus.length > 0) {
        this.loadingStatus = []        
      }
    }
  }
})