| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <el-menu
- :default-active="this.$route.path"
- router
- class="el-menu-vertical-demo"
- background-color="#334157"
- text-color="#fff"
- active-text-color="#ffd04b"
- :unique-opened="true"
- :collapse="collapsed"
- :collapse-transition="collapseTransition"
- >
- <div class="logobox">
- <a href="/bg" style="text-decoration-line: none">
- <img class="logoimg" src="@/assets/img/logo.png" alt="">
- </a>
- </div>
- <el-submenu v-for="item in menuList" :key="item.path" :index="item.path">
- <template slot="title">
- <i :class="item.icon" />
- <span>{{ item.title }}</span>
- </template>
- <el-menu-item-group>
- <el-menu-item v-for="child in item.children" :key="child.path" :index="child.path">
- <i :class="child.icon" />
- <span slot="title">{{ child.title }}</span>
- </el-menu-item>
- </el-menu-item-group>
- </el-submenu>
- </el-menu>
- </template>
- <script>
- import store from '@/store'
- export default {
- name: 'LeftAside',
- data() {
- return {
- collapsed: false,
- collapseTransition: false,
- menuList: []
- }
- },
- created() {
- for (const route of store.getters.addRoutes) {
- if (route.path === '/bg') {
- // devops 系统
- for (const route1 of route.children) {
- this.menuList.push(route1)
- }
- } else if (route.path.startsWith('/bg/')) {
- // tnb 系统
- this.menuList.push(route)
- }
- }
- // 钩子函数
- this.$root.Bus.$on('HandleSideMenu', value => {
- this.collapsed = value
- })
- },
- methods: {
- }
- }
- </script>
- <style>
- .el-menu-vertical-demo:not(.el-menu--collapse) {
- width: 180px;
- min-height: 720px;
- }
- .el-menu-vertical-demo:not(.el-menu--collapse) {
- border: none;
- text-align: left;
- }
- .logobox {
- height: 40px;
- line-height: 40px;
- color: #9d9d9d;
- font-size: 20px;
- text-align: center;
- padding: 20px 0px;
- }
- .logoimg {
- height: 40px;
- }
- </style>
|