清楚路由信息
This commit is contained in:
parent
95f4d40917
commit
7af2a98d84
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
<u-hamburger/>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-button type="text" style="margin-right: 10px" @click="toGitHub">Github地址</el-button>
|
||||
<u-screen-full/>
|
||||
<el-dropdown @command="commandAction">
|
||||
<span class="el-dropdown-link">
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue