refactor: ♻️ 菜单路由优化

This commit is contained in:
Ray.Hao
2025-05-20 23:14:31 +08:00
parent 1914657ce1
commit 1e584e9bc5
6 changed files with 29 additions and 35 deletions

View File

@@ -16,12 +16,13 @@ export function setupPermission() {
const isLogin = !!Storage.get(ACCESS_TOKEN_KEY, ""); // 判断是否登录
if (isLogin) {
if (to.path === "/login") {
// 已登录,访问登录页,跳转到首页
// 已登录,跳转到首页
next({ path: "/" });
} else {
// 未登录
const permissionStore = usePermissionStore();
// 判断路由是否加载完成
if (permissionStore.isRoutesLoaded) {
if (permissionStore.routesLoaded) {
if (to.matched.length === 0) {
// 路由未匹配跳转到404
next("/404");