feat: 增加全局loading

This commit is contained in:
fit2cloud-chenyw
2021-03-04 14:58:52 +08:00
parent 2b104fa0f6
commit 02230d5e51
12 changed files with 104 additions and 13 deletions

View File

@@ -0,0 +1,20 @@
import store from '@/store'
export const tryShowLoading = identification => {
if (!identification) return
// const count = store.getters.loadingMap[identification]
store.dispatch('request/addLoading', identification)
}
export const tryHideLoading = identification => {
if (!identification) return
const count = store.getters.loadingMap[identification]
if (count > 0) {
// setTimeout(() => {
// store.dispatch('request/reduceLoading', identification)
// }, 1000)
store.dispatch('request/reduceLoading', identification)
}
}