菜单
This commit is contained in:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user