jinjianback1.1/src/views/layout/components/Sidebar/index.vue

36 lines
774 B
Vue
Raw Normal View History

2017-06-26 13:38:24 +08:00
<template>
<el-scrollbar wrapClass="scrollbar-wrapper">
2018-04-18 14:47:20 +08:00
<el-menu
mode="vertical"
:show-timeout="200"
:default-active="$route.path"
:collapse="isCollapse"
background-color="#304156"
text-color="#bfcbd9"
active-text-color="#409EFF"
>
2018-07-13 15:02:42 +08:00
<sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path"></sidebar-item>
2017-11-24 16:30:40 +08:00
</el-menu>
</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 {
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>