6fa6f1085e548f39ece5f7c2e496a0b0bf78c80c.svn-base 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div :class="{'has-logo':showLogo}">
  3. <logo v-if="showLogo" :collapse="isCollapse" />
  4. <el-scrollbar wrap-class="scrollbar-wrapper">
  5. <el-menu
  6. :default-active="activeMenu"
  7. :collapse="isCollapse"
  8. :background-color="variables.menuBg"
  9. :text-color="variables.menuText"
  10. :unique-opened="false"
  11. :active-text-color="variables.menuActiveText"
  12. :collapse-transition="false"
  13. mode="vertical"
  14. >
  15. <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" />
  16. </el-menu>
  17. </el-scrollbar>
  18. </div>
  19. </template>
  20. <script>
  21. import { mapGetters } from 'vuex'
  22. import Logo from './Logo'
  23. import SidebarItem from './SidebarItem'
  24. import variables from '@/styles/variables.scss'
  25. export default {
  26. components: { SidebarItem, Logo },
  27. computed: {
  28. ...mapGetters([
  29. 'permission_routes',
  30. 'sidebar'
  31. ]),
  32. activeMenu() {
  33. const route = this.$route
  34. const { meta, path } = route
  35. // if set path, the sidebar will highlight the path you set
  36. if (meta.activeMenu) {
  37. return meta.activeMenu
  38. }
  39. return path
  40. },
  41. showLogo() {
  42. return this.$store.state.settings.sidebarLogo
  43. },
  44. variables() {
  45. return variables
  46. },
  47. isCollapse() {
  48. return !this.sidebar.opened
  49. }
  50. }
  51. }
  52. </script>