| | |
| | | import NProgress from 'nprogress' |
| | | import { useCommon } from '@/hooks/core/useCommon' |
| | | import { loadingService } from '@/utils/ui' |
| | | import { getPendingLoading, resetPendingLoading } from './beforeEach' |
| | | import { getPendingLoading, resetPendingLoading, triggerHomeRouteWarmup } from './beforeEach' |
| | | function setupAfterEachGuard(router) { |
| | | const { scrollToTop } = useCommon() |
| | | router.afterEach(() => { |
| | | const { scrollToTop, homePath } = useCommon() |
| | | router.afterEach((to) => { |
| | | scrollToTop() |
| | | const settingStore = useSettingStore() |
| | | if (settingStore.showNprogress) { |
| | |
| | | resetPendingLoading() |
| | | }) |
| | | } |
| | | nextTick(() => { |
| | | triggerHomeRouteWarmup(to.path, homePath.value || '/') |
| | | }) |
| | | }) |
| | | } |
| | | export { setupAfterEachGuard } |