zhou zhou
15 小时以前 46d872c1a5b77aa8799de4a64888a0a24a1422d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { nextTick } from 'vue'
import { useSettingStore } from '@/store/modules/setting'
import NProgress from 'nprogress'
import { useCommon } from '@/hooks/core/useCommon'
import { loadingService } from '@/utils/ui'
import { getPendingLoading, resetPendingLoading } from './beforeEach'
function setupAfterEachGuard(router) {
  const { scrollToTop } = useCommon()
  router.afterEach(() => {
    scrollToTop()
    const settingStore = useSettingStore()
    if (settingStore.showNprogress) {
      NProgress.done()
      setTimeout(() => {
        NProgress.remove()
      }, 600)
    }
    if (getPendingLoading()) {
      nextTick(() => {
        loadingService.hideLoading()
        resetPendingLoading()
      })
    }
  })
}
export { setupAfterEachGuard }