mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-16 15:19:25 +00:00
feat: 设置默认展开的子菜单
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
<el-menu
|
||||
class="left-menu"
|
||||
:default-active="activeMenu"
|
||||
:default-openeds="defaultOpensMenu"
|
||||
:collapse="isCollapse"
|
||||
:background-color="variables['menuBg']"
|
||||
:text-color="variables['menuText']"
|
||||
@@ -73,6 +74,7 @@ export default {
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'currentViewRoute',
|
||||
'defaultOpensMenu',
|
||||
'sidebar'
|
||||
]),
|
||||
activeMenu() {
|
||||
@@ -146,13 +148,17 @@ export default {
|
||||
.switch-view {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0;
|
||||
right: 16px;
|
||||
transform: translateY(-50%);
|
||||
z-index: 1;
|
||||
padding: 3px;
|
||||
line-height: 10px;
|
||||
border-radius: 3px;
|
||||
&:hover {
|
||||
color: var(--color-primary);
|
||||
background: var(--menu-hover)!important;
|
||||
}
|
||||
.icon {
|
||||
margin-right: 0!important;
|
||||
&:hover {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
const getters = {
|
||||
sidebar: state => state.app.sidebar,
|
||||
defaultOpensMenu: state => state.app.defaultOpensMenu,
|
||||
device: state => state.app.device,
|
||||
inited: state => state.app.inited,
|
||||
isMobile: state => state.app.device === 'mobile',
|
||||
|
@@ -5,6 +5,8 @@ const state = {
|
||||
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
|
||||
withoutAnimation: false
|
||||
},
|
||||
// 默认需要展开的菜单
|
||||
defaultOpensMenu: ['/audit/sessions', '/audit/logs', '/workbench/ops'],
|
||||
device: 'desktop',
|
||||
inited: false
|
||||
}
|
||||
|
Reference in New Issue
Block a user