Rap 原分销系统代码Web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

240490bf6f02c2361386cf49104f559a8a1bb73b.svn-base 1.4KB

5 months ago
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. :active-text-color="variables.menuActiveText"
  11. :collapse-transition="false"
  12. unique-opened
  13. mode="vertical"
  14. >
  15. <sidebar-item v-for="route in sidebarRouters" :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 '@/assets/styles/variables.scss'
  25. export default {
  26. components: { SidebarItem, Logo },
  27. computed: {
  28. ...mapGetters([
  29. 'sidebarRouters',
  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>