点击顶部菜单首页后自动跳转至首页模块

pull/59/head
smallchill 6 years ago
parent ecbadb5cce
commit abd139595d
  1. 16
      src/page/index/top/top-menu.vue

@ -3,18 +3,14 @@
<el-menu :default-active="activeIndex" <el-menu :default-active="activeIndex"
mode="horizontal" mode="horizontal"
text-color="#333"> text-color="#333">
<el-menu-item index="0" <el-menu-item index="0" @click.native="openHome(itemHome)" key="0">
@click.native="openMenu(itemHome)"
key="0">
<template slot="title"> <template slot="title">
<i :class="itemHome.source"></i> <i :class="itemHome.source"></i>
<span>{{generateTitle(itemHome)}}</span> <span>{{generateTitle(itemHome)}}</span>
</template> </template>
</el-menu-item> </el-menu-item>
<template v-for="(item,index) in items"> <template v-for="(item,index) in items">
<el-menu-item :index="item.id+''" <el-menu-item :index="item.id+''" @click.native="openMenu(item)" :key="index">
@click.native="openMenu(item)"
:key="index">
<template slot="title"> <template slot="title">
<i :class="item.source" style="padding-right: 5px;"></i> <i :class="item.source" style="padding-right: 5px;"></i>
<span>{{generateTitle(item)}}</span> <span>{{generateTitle(item)}}</span>
@ -48,7 +44,13 @@
...mapGetters(["tagCurrent", "menu"]) ...mapGetters(["tagCurrent", "menu"])
}, },
methods: { methods: {
openMenu (item) { openHome(itemHome) {
this.index.openMenu(itemHome);
this.$router.push({
path: this.$router.$avueRouter.getPath({name: itemHome.name, src: ''}, {})
});
},
openMenu(item) {
this.index.openMenu(item) this.index.openMenu(item)
}, },
getMenu() { getMenu() {

Loading…
Cancel
Save