Blame view

src/layout/components/Sidebar/sidebarLeft.vue 1.11 KB
任超 committed
1
<template>
任超 committed
2
  <el-menu router :default-active="activeMenu" mode="horizontal">
任超 committed
3
    <!-- 权限菜单 -->
任超 committed
4
    <sidebar-item v-for="route in permission_routes.slice(1, 4)" :key="route.path" :item="route"
任超 committed
5
      :base-path="route.path" />
任超 committed
6
    <!-- 菜单全部展示 -->
任超 committed
7
    <!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> -->
任超 committed
8 9 10 11 12 13 14 15
  </el-menu>
</template>

<script>
import { mapGetters } from 'vuex'
import Logo from './Logo'
import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss'
任超 committed
16
import { asyncRoutes } from '@/router'
任超 committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
export default {
  components: { SidebarItem, Logo },
  computed: {
    ...mapGetters(['permission_routes', 'sidebar']),
    activeMenu () {
      const route = this.$route
      const { meta, path } = route
      if (meta.activeMenu) {
        return meta.activeMenu
      }
      return path
    },
    variables () {
      return variables
    },
    asyncRoutes () {
任超 committed
33
      return asyncRoutes.slice(0, 3)
任超 committed
34 35 36 37 38 39 40 41 42 43
    }
  }
}
</script>
<style scoped lang="scss">
.el-menu--horizontal {
  display: flex;
  background: none !important;
}
</style>