1234567891011121314151617181920212223242526272829303132333435 |
- import load from '@/utils/loading'
- // isLoading
- // let times = store.getters.loadCount;
- let timer = null
- export async function showFullScreenLoading(store) {
- if (store.getters.loadCount === 0 && !store.getters.isLoading) {
- await store.dispatch('app/setLoadCount', 1)
- await store.dispatch('app/setLoadStatus', true)
- load.startLoading()
- } else {
- await store.dispatch('app/setLoadCount', 1)
- clearTimeout(timer)
- timer = null
- }
- }
- export async function tryHideFullScreenLoading(store) {
- await store.dispatch('app/setLoadCount', -1)
- if (store.getters.loadCount <= 0 && store.getters.isLoading) {
- timer = setTimeout(async () => {
- await store.dispatch('app/resetLoadCount')
- await store.dispatch('app/setLoadStatus', false)
- load.endLoading();
- clearTimeout(timer)
- timer = null
- }, 100)
- }
- }
|