mirror of
https://gitee.com/dromara/go-view.git
synced 2026-05-12 00:00:01 +08:00
fix: 封装header
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
import { Router } from 'vue-router';
|
||||
import { PageEnum } from '@/enums/pageEnum'
|
||||
|
||||
|
||||
export function createRouterGuards(router: Router) {
|
||||
// 前置
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const Loading = window['$loading'] || null;
|
||||
Loading && Loading.start();
|
||||
|
||||
console.log(to)
|
||||
const isErrorPage = router.getRoutes().findIndex((item) => item.name === to.name);
|
||||
if (isErrorPage === -1) {
|
||||
next({ name: PageEnum.ERROR_PAGE_NAME_404 })
|
||||
@@ -17,7 +16,6 @@ export function createRouterGuards(router: Router) {
|
||||
|
||||
router.afterEach((to, _, failure) => {
|
||||
const Loading = window['$loading'] || null;
|
||||
Loading && Loading.start();
|
||||
document.title = (to?.meta?.title as string) || document.title;
|
||||
Loading && Loading.finish();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user