This commit is contained in:
2023-05-29 17:27:57 +08:00
parent d920d0130b
commit 9c741c940e
4 changed files with 5 additions and 30 deletions

View File

@@ -5,8 +5,8 @@
<img src="../../../images/aio/logo_1.png" alt="诺力">
</div>
<div class="horizontal-menu-container">
<el-menu :default-active="activeIndex" mode="horizontal" @select="handleSelect">
<el-menu-item :index="menu.index" v-for="menu in menus" :key="menu.index">{{menu.label}}</el-menu-item>
<el-menu :default-active="$route.path" mode="horizontal" @select="handleSelect">
<el-menu-item :index="menu.router" v-for="menu in menus" :key="menu.index">{{menu.label}}</el-menu-item>
</el-menu>
</div>
<div class="header-wraper__right">
@@ -95,7 +95,6 @@ export default {
data () {
return {
username: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).user.username : '',
activeIndex: this.$store.getters.defaultActive,
menus: [{
label: '首页',
index: '1',
@@ -128,16 +127,6 @@ export default {
unclick: false
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.menus.map(el => {
if (el.router === vm.$route.path) {
vm.activeIndex = el.index
vm.$store.dispatch('getDefaultActive', el.index)
}
})
})
},
watch: {
oldpassword (val) {
if (val === '' || this.newpassword1 === '' || this.newpassword2 === '') {
@@ -163,11 +152,9 @@ export default {
},
methods: {
handleSelect (key) {
this.activeIndex = key
this.$store.dispatch('getDefaultActive', key)
this.dropdown = false
this.$router.push({
path: this.menus[Number(key) - 1].router
path: key
})
},
showDropdown () {