测试路由重定向
This commit is contained in:
@@ -9,7 +9,7 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
path: "/",
|
path: "/",
|
||||||
// redirect重定向
|
// redirect重定向
|
||||||
redirect: "/login"
|
redirect: "/login"
|
||||||
// redirect: "/Upgrade"
|
// redirect: "/upgrade"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
@@ -68,6 +68,8 @@ const router = createRouter({
|
|||||||
// history: createWebHashHistory(),
|
// history: createWebHashHistory(),
|
||||||
routes
|
routes
|
||||||
})
|
})
|
||||||
|
console.log(123123123);
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
// 系统维护
|
// 系统维护
|
||||||
// const toName = to.name === 'upgrade';
|
// const toName = to.name === 'upgrade';
|
||||||
@@ -90,11 +92,8 @@ router.beforeEach((to, from, next) => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(routeExists);
|
|
||||||
|
|
||||||
if (routeExists) {
|
if (routeExists) {
|
||||||
console.log(isMurmur, murmurStr, token);
|
|
||||||
|
|
||||||
if (isMurmur && murmurStr && token) {
|
if (isMurmur && murmurStr && token) {
|
||||||
const toName = to.name === 'login';
|
const toName = to.name === 'login';
|
||||||
if (toName) {
|
if (toName) {
|
||||||
@@ -105,7 +104,6 @@ router.beforeEach((to, from, next) => {
|
|||||||
} else {
|
} else {
|
||||||
// 如果页面存在,正常跳转
|
// 如果页面存在,正常跳转
|
||||||
const toName = to.name === 'upgrade';
|
const toName = to.name === 'upgrade';
|
||||||
console.log(toName);
|
|
||||||
|
|
||||||
if (toName) {
|
if (toName) {
|
||||||
next({ name: 'login' });
|
next({ name: 'login' });
|
||||||
|
|||||||
Reference in New Issue
Block a user