2017-06-26 13:38:24 +08:00
|
|
|
<template>
|
2018-08-20 15:45:15 +08:00
|
|
|
<el-scrollbar wrap-class="scrollbar-wrapper">
|
2018-04-18 14:47:20 +08:00
|
|
|
<el-menu
|
|
|
|
:show-timeout="200"
|
|
|
|
:default-active="$route.path"
|
|
|
|
:collapse="isCollapse"
|
2018-08-20 15:45:15 +08:00
|
|
|
mode="vertical"
|
2018-04-18 14:47:20 +08:00
|
|
|
background-color="#304156"
|
|
|
|
text-color="#bfcbd9"
|
|
|
|
active-text-color="#409EFF"
|
|
|
|
>
|
2018-08-20 15:45:15 +08:00
|
|
|
<sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path"/>
|
2017-11-24 16:30:40 +08:00
|
|
|
</el-menu>
|
2018-05-07 14:53:03 +08:00
|
|
|
</el-scrollbar>
|
2017-06-26 13:38:24 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2017-11-24 16:30:40 +08:00
|
|
|
import { mapGetters } from 'vuex'
|
2017-08-30 17:42:06 +08:00
|
|
|
import SidebarItem from './SidebarItem'
|
2017-11-24 16:30:40 +08:00
|
|
|
|
2017-08-30 17:42:06 +08:00
|
|
|
export default {
|
2018-05-07 14:53:03 +08:00
|
|
|
components: { SidebarItem },
|
2017-08-30 17:42:06 +08:00
|
|
|
computed: {
|
2017-11-24 16:30:40 +08:00
|
|
|
...mapGetters([
|
|
|
|
'sidebar'
|
|
|
|
]),
|
2017-10-18 15:05:30 +08:00
|
|
|
routes() {
|
|
|
|
return this.$router.options.routes
|
2017-11-24 16:30:40 +08:00
|
|
|
},
|
|
|
|
isCollapse() {
|
|
|
|
return !this.sidebar.opened
|
2017-10-18 15:05:30 +08:00
|
|
|
}
|
2017-08-30 17:42:06 +08:00
|
|
|
}
|
|
|
|
}
|
2017-06-26 13:38:24 +08:00
|
|
|
</script>
|