|
@@ -32,7 +32,7 @@ router.beforeEach(async(to, from, next) => {
|
|
|
// console.log('to.matched')
|
|
|
// console.log(to.matched)
|
|
|
if (to.matched.length === 0) {
|
|
|
- alert('没有匹配')
|
|
|
+ // alert('没有匹配')
|
|
|
next('/404') // 判断此跳转路由的来源路由是否存在,存在的情况跳转到来源路由,否则跳转到404页面
|
|
|
}
|
|
|
next()
|
|
@@ -53,20 +53,15 @@ router.beforeEach(async(to, from, next) => {
|
|
|
}
|
|
|
|
|
|
accessRoutes.forEach((item) => {
|
|
|
- console.log('item')
|
|
|
- console.log(item)
|
|
|
- router.addRoute(item)
|
|
|
- })
|
|
|
- // alert(accessRoutes[accessRoutes.length - 1].redirect)
|
|
|
- // accessRoutes[accessRoutes.length - 1].redirect = "systemManage/userManage"
|
|
|
- // alert(accessRoutes[accessRoutes.length - 1].redirect)
|
|
|
+
|
|
|
+ router.addRoute(item)
|
|
|
+ })
|
|
|
+
|
|
|
if (accessRoutes[1].path != '/') {
|
|
|
- // alert(2)
|
|
|
next(accessRoutes[1].path)
|
|
|
|
|
|
} else {
|
|
|
- console.log('accessRoutes')
|
|
|
- console.log(accessRoutes)
|
|
|
+
|
|
|
|
|
|
next({...to, replace: true })
|
|
|
|