feat: 调整父级菜单有路由时可以跳转
This commit is contained in:
@@ -8,15 +8,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
<el-menu :collapse="isShrink" :default-active="route" active-text-color="#FA901C" class="menu-list" mode="vertical" text-color="#BEBEBE" unique-opened @select="jump">
|
<el-menu :collapse="isShrink" :default-active="route" active-text-color="#FA901C" class="menu-list" mode="vertical" text-color="#BEBEBE" unique-opened @select="jump" @open="jump">
|
||||||
<template v-for="(menu, index) in menuList">
|
<template v-for="(menu, index) in menuList">
|
||||||
<el-submenu v-if="menu.children && menu.children.length > 0" :key="index" :index="`${index}`">
|
<el-submenu v-if="menu.children && menu.children.length > 0" :key="index" :index="(menu.route || `${index}`)">
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<i :class="menu.icon"></i>
|
<i :class="menu.icon"></i>
|
||||||
<span slot="title">{{$t(menu.i18n)}}</span>
|
<span slot="title">{{$t(menu.i18n)}}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(secondMenu, secondIndex) in menu.children">
|
<template v-for="(secondMenu, secondIndex) in menu.children">
|
||||||
<el-submenu v-if="secondMenu.children && secondMenu.children.length > 0" :key="secondIndex" :index="`${index}-${secondIndex}`" class="secondMenu">
|
<el-submenu v-if="secondMenu.children && secondMenu.children.length > 0" :key="secondIndex" :index="(secondMenu.route || `${index}-${secondIndex}`)" class="secondMenu">
|
||||||
<span slot="title" class="data-column__span">{{$t(secondMenu.i18n)}}</span>
|
<span slot="title" class="data-column__span">{{$t(secondMenu.i18n)}}</span>
|
||||||
<el-menu-item v-for="(thirdMenu, thirdIndex) in secondMenu.children" :key="`${index}-${secondIndex}-${thirdIndex}`" :index="thirdMenu.route" class="thirdMenu">{{$t(thirdMenu.i18n)}}</el-menu-item>
|
<el-menu-item v-for="(thirdMenu, thirdIndex) in secondMenu.children" :key="`${index}-${secondIndex}-${thirdIndex}`" :index="thirdMenu.route" class="thirdMenu">{{$t(thirdMenu.i18n)}}</el-menu-item>
|
||||||
</el-submenu>
|
</el-submenu>
|
||||||
@@ -109,6 +109,9 @@ export default {
|
|||||||
},
|
},
|
||||||
jump (route) {
|
jump (route) {
|
||||||
// this.$store.commit('setTimePickerRange', []) // 切换路由时清空已选择的时间
|
// this.$store.commit('setTimePickerRange', []) // 切换路由时清空已选择的时间
|
||||||
|
if (!route.startsWith('/')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (route === this.route) {
|
if (route === this.route) {
|
||||||
this.refresh()
|
this.refresh()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user