From 52d175d89b4801cc30c258b93789b783be0bba3b Mon Sep 17 00:00:00 2001 From: Your Name <123456> Date: 星期二, 07 二月 2023 10:48:04 +0800 Subject: [PATCH] 菜单 --- src/router/index.ts | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 322d85c..a99e192 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -12,6 +12,7 @@ import { initBackEndControlRoutes } from '/@/router/backEnd'; import { useUserInfo } from '/@/stores/userInfo'; import { nextTick } from 'vue'; +import Cookies from 'js-cookie'; // 读取 `/src/stores/themeConfig.ts` 是否开启后端控制路由配置 const storesThemeConfig = useThemeConfig(pinia); @@ -68,7 +69,7 @@ router.beforeEach(async (to, from, next) => { NProgress.configure({ showSpinner: false }); if (to.meta.title) NProgress.start(); - const token = Session.get('token'); + const token = Cookies.get('token'); if (to.path === '/login' && !token) { next(); NProgress.done(); @@ -84,7 +85,6 @@ const storesRoutesList = useRoutesList(pinia); const { routesList } = storeToRefs(storesRoutesList); if (routesList.value.length === 0) { - // 后端控制路由:路由数据初始化,防止刷新时丢失 await initBackEndControlRoutes(); // 动态添加路由:防止非首页刷新时跳转回首页的问题 -- Gitblit v1.9.2