index.vue 761 Bytes
Newer Older
Pan's avatar
Pan committed
1
<template>
2
  <el-scrollbar wrap-class="scrollbar-wrapper">
Pan's avatar
Pan committed
3 4 5 6
    <el-menu
      :show-timeout="200"
      :default-active="$route.path"
      :collapse="isCollapse"
7
      mode="vertical"
Pan's avatar
Pan committed
8 9 10 11
      background-color="#304156"
      text-color="#bfcbd9"
      active-text-color="#409EFF"
    >
12
      <sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path"/>
Pan's avatar
Pan committed
13
    </el-menu>
14
  </el-scrollbar>
Pan's avatar
Pan committed
15 16 17
</template>

<script>
Pan's avatar
Pan committed
18
import { mapGetters } from 'vuex'
Pan's avatar
Pan committed
19
import SidebarItem from './SidebarItem'
Pan's avatar
Pan committed
20

Pan's avatar
Pan committed
21
export default {
22
  components: { SidebarItem },
Pan's avatar
Pan committed
23
  computed: {
Pan's avatar
Pan committed
24 25 26
    ...mapGetters([
      'sidebar'
    ]),
27 28
    routes() {
      return this.$router.options.routes
Pan's avatar
Pan committed
29 30 31
    },
    isCollapse() {
      return !this.sidebar.opened
32
    }
Pan's avatar
Pan committed
33 34
  }
}
Pan's avatar
Pan committed
35
</script>