2024-04-03 18:19:28 +08:00

91 lines
2.2 KiB
Vue

<template>
<div class="menuBox">
<el-menu
:default-active="$route.path"
class="el-menu-demo"
mode="horizontal"
@select="handleSelect"
active-text-color="#5181F6"
router
>
<el-menu-item
target="_blank"
:index="item.url"
v-for="(item,index) in $store.state.menuList"
:key="index"
>{{item.name}}</el-menu-item>
</el-menu>
<el-button
v-show="$store.state.isShowBackIndex"
class="backtoIndex"
type="primary"
plain
@click="backtoIndex()"
size="mini"
>返回主菜单</el-button>
</div>
</template>
<script>
export default {
data() {
return {
// menuList: [{ name: "企业注册审核", url: "/registerAudit" }],
currentUrl: "",
};
},
created() {
// if(this.$store.state.userInfo.accountType!=1){
// this.menuList=[{ name: "组织架构管理", url: "/companyAdmin/companyDiagram" },
// // { name: "项目管理", url: "/companyAdmin/projectManager" },
// { name: "文档资料上传", url: "/companyAdmin/docManage" }]
// // if(this.$store.state.currentUrl==""){
// // // this.$store.commit('setCurrentUrl',this.menuList[0].url)
// // this.$store.dispatch('currentUrl',this.menuList[0].url)
// // }
// }
},
mounted() {
console.log("mounted", this.$route.path);
},
methods: {
backtoIndex() {
// this.$router.push("/projectIndex");
this.$router.push("/workSpace");
},
handleSelect(url) {
// this.$store.commit('setCurrentUrl',url)
// this.$store.dispatch('currentUrl',url)
},
},
};
</script>
<style lang="less" scoped>
.el-menu.el-menu--horizontal {
box-sizing: border-box;
padding: 0 162px 4px;
border-bottom: none;
}
.el-menu--horizontal > .el-menu-item {
font-family: PingFangSC-Medium;
font-size: 14px;
letter-spacing: 0;
height: 44px;
line-height: 44px;
padding: 0;
margin-right: 170px;
}
.el-menu--horizontal > .el-menu-item.is-active {
border-bottom: 3px solid #409eff;
}
.menuBox {
position: relative;
}
.backtoIndex {
position: absolute;
right: 20px;
top: 12px;
font-size: 14px;
padding: 4px 5px;
}
</style>