feat: 登录跳转多标签页面
This commit is contained in:
@@ -2,7 +2,7 @@ import { createRouter, createWebHistory } from "vue-router";
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: "/",
|
||||
path: "/login",
|
||||
name: "Login",
|
||||
component: () => import("@/views/login/index.vue"),
|
||||
},
|
||||
@@ -27,10 +27,10 @@ const router = createRouter({
|
||||
router.beforeEach((to, _from, next) => {
|
||||
const token = localStorage.getItem("token");
|
||||
if (to.meta && (to.meta as any).requiresAuth && !token) {
|
||||
next({ path: "/" });
|
||||
next({ path: "/login" });
|
||||
return;
|
||||
}
|
||||
if (to.path === "/" && token) {
|
||||
if (token && to.path !== "/browser") {
|
||||
next({ path: "/browser" });
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user