mirror of
https://gitee.com/dromara/go-view.git
synced 2026-05-12 00:00:01 +08:00
fix:路由处理,CSS处理,样式处理,全局变量处理
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import { Router } from 'vue-router';
|
||||
import { ErrorPageRoute } from '@/router/base';
|
||||
import { PageEnum } from '@/enums/pageEnum'
|
||||
|
||||
export function createRouterGuards(router: Router) {
|
||||
// 前置
|
||||
@@ -8,14 +7,12 @@ export function createRouterGuards(router: Router) {
|
||||
const Loading = window['$loading'] || null;
|
||||
Loading && Loading.start();
|
||||
|
||||
//添加404
|
||||
const isErrorPage = router.getRoutes().findIndex((item) => item.name === ErrorPageRoute.name);
|
||||
console.log(to)
|
||||
const isErrorPage = router.getRoutes().findIndex((item) => item.name === to.name);
|
||||
if (isErrorPage === -1) {
|
||||
router.addRoute(ErrorPageRoute as unknown as RouteRecordRaw);
|
||||
next({ name: PageEnum.ERROR_PAGE_NAME_404 })
|
||||
}
|
||||
|
||||
next()
|
||||
Loading && Loading.finish();
|
||||
})
|
||||
|
||||
router.afterEach((to, _, failure) => {
|
||||
|
||||
Reference in New Issue
Block a user