增加侧边栏导航是否保持展开一个子项的配置

This commit is contained in:
hooray 2021-08-29 15:16:25 +08:00
parent 89f33e8e55
commit 01d54dcbad
3 changed files with 23 additions and 2 deletions

View File

@ -7,7 +7,7 @@
}"
/>
<!-- 侧边栏模式无主导航 -->
<el-menu unique-opened :default-active="$route.meta.activeMenu || $route.path" :collapse="$store.state.settings.mode === 'pc' && $store.state.settings.sidebarCollapse" :collapse-transition="false" :class="{
<el-menu :unique-opened="$store.state.settings.sidebarUniqueOpened" :default-active="$route.meta.activeMenu || $route.path" :collapse="$store.state.settings.mode === 'pc' && $store.state.settings.sidebarCollapse" :collapse-transition="false" :class="{
'is-collapse-without-logo': $store.state.settings.menuMode !== 'single' && $store.state.settings.mode === 'pc' && $store.state.settings.sidebarCollapse
}"
>

View File

@ -36,7 +36,16 @@
<svg-icon name="el-icon-question" />
</el-tooltip>
</div>
<el-switch v-model="switchSidebarAndPageJump" />
<el-switch v-model="switchSidebarAndPageJump" :disabled="['single'].includes($store.state.settings.menuMode)" />
</div>
<div class="setting-item">
<div class="label">
保持展开一个
<el-tooltip content="开启该功能后,侧边栏只保持一个子菜单的展开" placement="top" :append-to-body="false">
<svg-icon name="ri-question-line" />
</el-tooltip>
</div>
<el-switch v-model="sidebarUniqueOpened" />
</div>
<el-divider>顶栏</el-divider>
<div class="setting-item">
@ -195,6 +204,16 @@ export default {
})
}
},
sidebarUniqueOpened: {
get: function() {
return this.$store.state.settings.sidebarUniqueOpened
},
set: function(newValue) {
this.$store.commit('settings/updateThemeSetting', {
'sidebarUniqueOpened': newValue
})
}
},
topbarFixed: {
get: function() {
return this.$store.state.settings.topbarFixed

View File

@ -22,6 +22,8 @@ let globalSettings = {
sidebarCollapse: false,
// 切换侧边栏同时跳转页面
switchSidebarAndPageJump: false,
// 侧边栏只保持一个子菜单的展开
sidebarUniqueOpened: true,
// 顶栏(顶部导航栏和标签栏)是否固定
topbarFixed: true,
// 是否开启面包屑导航