diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 7721d05..09ff744 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -72,7 +72,8 @@ import {computed, nextTick, onMounted, reactive, ref, watch} from "vue"; } const initTags = ()=>{ - let routesNew = routes.value.filter(item=>item.path!=='/login') + // let routesNew = routes.value.filter(item=>item.path!=='/login') + let routesNew = routes.value let affixTag = affixTags.value = filterAffixTags(routesNew) for (const tag of affixTag) { if (tag.name) { diff --git a/src/layout/components/UHeader/index.vue b/src/layout/components/UHeader/index.vue index f51578d..f119d42 100644 --- a/src/layout/components/UHeader/index.vue +++ b/src/layout/components/UHeader/index.vue @@ -9,6 +9,7 @@
+ Github地址 @@ -53,6 +54,9 @@ return store.state.user.userInfo }) + const toGitHub = ()=>{ + window.open('https://github.com/zouzhibin/vue-admin-perfect') + } const logOut = async ()=>{ ElMessageBox.confirm( '确定退出登录吗?', @@ -67,6 +71,8 @@ try { await store.dispatch('user/logout') router.push({path:'/login'}) + store.dispatch('permission/clearRoutes') + store.dispatch('tagsView/clearVisitedView') }catch (e) { } @@ -80,7 +86,8 @@ switch (key){ case 1: logOut() - store.dispatch('tagsView/clearVisitedView') + + break; case 2: person.value.show() diff --git a/src/router/index.ts b/src/router/index.ts index 238cc3d..6de9c07 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHistory, RouteRecordRaw,createWebHashHistory } from 'vue-router' +import { createRouter, createWebHistory, RouteRecordRaw,createWebHashHistory,Router } from 'vue-router' import Layout from "@/layout/index.vue"; // 引入组件 @@ -61,4 +61,7 @@ const router = createRouter({ routes:constantRoutes }) + + + export default router diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index b1e814a..3ab1062 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -47,9 +47,11 @@ const mutations = { SET_ROUTES: (state, routes) => { state.addRoutes = routes state.routes = constantRoutes.concat(routes) - - - } + }, + CLEAR_ROUTERS:(state, routes) => { + state.addRoutes = [] + state.routes = [] + }, } const actions = { @@ -66,6 +68,9 @@ const actions = { commit('SET_ROUTES', accessedRoutes) resolve(accessedRoutes) }) + }, + clearRoutes({commit}){ + commit('CLEAR_ROUTERS') } }