index.vue 679 Bytes
Newer Older
Pan's avatar
Pan committed
1
<template>
Pan's avatar
Pan committed
2 3
  <scroll-bar>
    <el-menu mode="vertical" unique-opened :default-active="$route.path" :collapse="isCollapse" background-color="#304156" text-color="#fff" active-text-color="#409EFF">
Pan's avatar
Pan committed
4
      <sidebar-item :routes="routes"></sidebar-item>
Pan's avatar
Pan committed
5 6
    </el-menu>
  </scroll-bar>
Pan's avatar
Pan committed
7 8 9
</template>

<script>
Pan's avatar
Pan committed
10
import { mapGetters } from 'vuex'
Pan's avatar
Pan committed
11
import SidebarItem from './SidebarItem'
Pan's avatar
Pan committed
12 13
import ScrollBar from '@/components/ScrollBar'

Pan's avatar
Pan committed
14
export default {
Pan's avatar
Pan committed
15
  components: { SidebarItem, ScrollBar },
Pan's avatar
Pan committed
16
  computed: {
Pan's avatar
Pan committed
17 18 19
    ...mapGetters([
      'sidebar'
    ]),
20 21
    routes() {
      return this.$router.options.routes
Pan's avatar
Pan committed
22 23 24
    },
    isCollapse() {
      return !this.sidebar.opened
25
    }
Pan's avatar
Pan committed
26 27
  }
}
Pan's avatar
Pan committed
28
</script>