wangrong
2026-08-30 761e5c5fa871959f60e15c971c8d83f2b53d0af5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { useRequestStoreWithOut } from '@/store/modules/request'
const requestStore = useRequestStoreWithOut()
 
export const tryShowLoading = identification => {
  if (!identification) return
  requestStore.addLoading(identification)
}
 
export const tryHideLoading = identification => {
  if (!identification) return
  const count = requestStore.loadingMap[identification]
  if (count > 0) {
    requestStore.reduceLoading(identification)
  }
}
/**
 * 说明
 * 要在view中加loading只需要两个步骤
 * 1.在vue页面文件中加 v-loading="requestStore.loadingMap[permissionStore.currentPath]"
 *     例如:views/system/user/index.vue
 * 2.在需要loading的api中添加config {loading: true}
 *     例如:api/system/user.js中userLists方法 需要配置loading: true
 * 针对整个view页面,需要局部loading请在对应页面中自己添加
 */