|  |  | 
 |  |  | <template> | 
 |  |  |   <div class="menu" :class="{collapse: menuData.collapse}"> | 
 |  |  |     <div class="logo"> | 
 |  |  |       <div><img src="@/assets/logo.png"></div> | 
 |  |  |       <h1 :class="{hidden: menuData.collapse}">豆米跳跳</h1> | 
 |  |  |     </div> | 
 |  |  |     <scrollbar> | 
 |  |  |       <el-menu | 
 |  |  |         ref="menu" | 
 |  |  | 
 |  |  |         :collapse="menuData.collapse" | 
 |  |  |         :default-openeds="defaultOpeneds" | 
 |  |  |         :collapse-transition="false" | 
 |  |  |         unique-opened | 
 |  |  |         @select="handleSelect" | 
 |  |  |       > | 
 |  |  |         <MenuItems v-for="menu in menuData.list" :key="menu.index" :menu="menu" :is-root-menu="true"/> | 
 |  |  | 
 |  |  |       const menuConfig = this.__getMenuConfig(path, 'url', this.menuData.list) | 
 |  |  |       if (menuConfig == null) { | 
 |  |  |         return null | 
 |  |  |       } else { | 
 |  |  |         this.$store.commit("pushtags", menuConfig) | 
 |  |  |       } | 
 |  |  |       // console.log(menuConfig.index); | 
 |  |  |       return menuConfig.index | 
 |  |  |     }, | 
 |  |  |     // 默认展开的菜单index | 
 |  |  |     defaultOpeneds () { | 
 |  |  |       return this.menuData.list.map(menu => menu.index) | 
 |  |  |       // return this.menuData.list.map(menu => menu.index) | 
 |  |  |        | 
 |  |  |       return [this.menuData.list[0].index] | 
 |  |  |     } | 
 |  |  |   }, | 
 |  |  |   methods: { | 
 |  |  | 
 |  |  |       if (menuConfig.url == null || menuConfig.url.trim().length === 0) { | 
 |  |  |         return | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |       this.$router.push(menuConfig.url) | 
 |  |  |       this.$store.commit("pushtags", menuConfig) | 
 |  |  |     }, | 
 |  |  |     // 获取菜单配置 | 
 |  |  |     __getMenuConfig (value, key, menus) { | 
 |  |  | 
 |  |  |   height: 100%; | 
 |  |  |   display: flex; | 
 |  |  |   flex-direction: column; | 
 |  |  |   // LOGO | 
 |  |  |   .logo { | 
 |  |  |     height: 60px; | 
 |  |  |     flex-shrink: 0; | 
 |  |  |     line-height: 60px; | 
 |  |  |     overflow: hidden; | 
 |  |  |     display: flex; | 
 |  |  |     background: $primary-color - 20; | 
 |  |  |     padding: 0 16px; | 
 |  |  |     & > div { | 
 |  |  |       width: 32px; | 
 |  |  |       flex-shrink: 0; | 
 |  |  |       margin-right: 12px; | 
 |  |  |       img { | 
 |  |  |         width: 100%; | 
 |  |  |         flex-shrink: 0; | 
 |  |  |         vertical-align: middle; | 
 |  |  |         position: relative; | 
 |  |  |         top: -2px; | 
 |  |  |       } | 
 |  |  |     } | 
 |  |  |     h1 { | 
 |  |  |       font-size: 16px; | 
 |  |  |       font-weight: 500; | 
 |  |  |       transition: opacity ease .3s; | 
 |  |  |       overflow: hidden; | 
 |  |  |       &.hidden { | 
 |  |  |         opacity: 0; | 
 |  |  |       } | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  | } | 
 |  |  | </style> | 
 |  |  | <style lang="scss"> | 
 |  |  | 
 |  |  |     background: $primary-color; | 
 |  |  |     // 选中状态 | 
 |  |  |     &.is-active { | 
 |  |  |       background: $primary-color - 40 !important; | 
 |  |  |       background: $primary-color-sel !important; | 
 |  |  |     } | 
 |  |  |     // 悬浮 | 
 |  |  |     &:hover { | 
 |  |  |       background-color: $primary-color - 12; | 
 |  |  |       background-color: $primary-color-hover; | 
 |  |  |     } | 
 |  |  |     &:focus { | 
 |  |  |       background: $primary-color; | 
 |  |  | 
 |  |  |     } | 
 |  |  |     &.is-active { | 
 |  |  |       .el-submenu__title{ | 
 |  |  |         background-color: $primary-color - 20; | 
 |  |  |         background-color: $icon-background-color; | 
 |  |  |       } | 
 |  |  |       .el-menu .el-menu-item{ | 
 |  |  |         background-color: $primary-color - 20; | 
 |  |  |         background-color: $icon-background-color; | 
 |  |  |         // 悬浮 | 
 |  |  |         &:hover { | 
 |  |  |           background-color: $primary-color - 30; | 
 |  |  |           background-color: $icon-background-color; | 
 |  |  |         } | 
 |  |  |       } | 
 |  |  |     } |