diff --git a/src/layout/TagsView/index.vue b/src/layout/TagsView/index.vue index b128f88..7d46e3b 100644 --- a/src/layout/TagsView/index.vue +++ b/src/layout/TagsView/index.vue @@ -13,7 +13,7 @@ :key="tag.path" class="item-tag-wrap" :class="isActive(tag) ? 'active' : ''" - @click="routerGo(tag)" + @click.stop="routerGo(tag)" >
{{ tag.title }}
{ + console.log(111111111111) router.push({ path: tag.path, query: tag.query, diff --git a/src/permission.ts b/src/permission.ts index e779905..b2bc702 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -17,7 +17,7 @@ router.beforeEach(async(to, from, next) => { if(typeof(to.meta.title) === 'string'){ document.title = to.meta.title ||'vue-admin-perfect' } - const UserStore = useUserStore(); + const UserStore = useUserStore(); // 确定用户是否已登录过,存在Token const hasToken = UserStore.token if (hasToken) { @@ -46,7 +46,6 @@ router.beforeEach(async(to, from, next) => { next() } else { next(`/login?redirect=${to.path}`) - } } }) diff --git a/src/router/index.ts b/src/router/index.ts index a2556a0..60238a5 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -4,16 +4,6 @@ import Layout from "@/layout/index.vue"; interface extendRoute { hidden?:boolean } -// * 导入所有router -const metaRouters = import.meta.globEager("./modules/*.ts"); -// * 处理路由表 -export const routerArray: RouteRecordRaw[] = []; -Object.keys(metaRouters).forEach(item => { - Object.keys(metaRouters[item]).forEach((key: any) => { - routerArray.push(...metaRouters[item][key]); - }); -}); - // import tableRouter from './modules/table' import dataScreenRouter from './modules/dataScreen' diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 59d7787..5c1a1df 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -43,7 +43,7 @@ export const usePermissionStore = defineStore({ this.cacheRoutes = [] }, getCacheRoutes(){ - this.cacheRoutes = filterKeepAlive(routerArray) + this.cacheRoutes = filterKeepAlive(asyncRoutes) return this.cacheRoutes } },