| | |
| | | router.addRoute(route); // 动态添加可访问路由表 |
| | | } |
| | | }); |
| | | const n = { ...to, replace: true }; |
| | | console.log(n); |
| | | // @ts-expect-error hack方法 确保addRoutes已完成 |
| | | next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成 |
| | | } |
| | | } else { |
| | |
| | | // 在免登录白名单,直接进入 |
| | | next(); |
| | | } else { |
| | | next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页 |
| | | const redirect = encodeURIComponent(to.fullPath || '/'); |
| | | next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页 |
| | | NProgress.done(); |
| | | } |
| | | } |