v3.8.2 开启TopNav没有子菜单情况隐藏侧边栏

This commit is contained in:
YunaiV
2022-03-20 22:58:13 +08:00
parent 82a3a8387c
commit 1a2c03bc7e
44 changed files with 76 additions and 71 deletions

View File

@ -3,7 +3,8 @@ import Cookies from 'js-cookie'
const state = {
sidebar: {
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
withoutAnimation: false
withoutAnimation: false,
hide: false
},
device: 'desktop',
size: Cookies.get('size') || 'medium'
@ -30,6 +31,9 @@ const mutations = {
SET_SIZE: (state, size) => {
state.size = size
Cookies.set('size', size)
},
SET_SIDEBAR_HIDE: (state, status) => {
state.sidebar.hide = status
}
}
@ -45,6 +49,9 @@ const actions = {
},
setSize({ commit }, size) {
commit('SET_SIZE', size)
},
toggleSideBarHide({ commit }, status) {
commit('SET_SIDEBAR_HIDE', status)
}
}

View File

@ -18,12 +18,7 @@ const permission = {
state.defaultRoutes = constantRoutes.concat(routes)
},
SET_TOPBAR_ROUTES: (state, routes) => {
// 顶部导航菜单默认添加统计报表栏指向首页
const index = [{
path: 'index',
meta: { title: '统计报表', icon: 'dashboard'}
}]
state.topbarRouters = routes.concat(index);
state.topbarRouters = routes
},
SET_SIDEBAR_ROUTERS: (state, routes) => {
state.sidebarRouters = routes