edu/admin/src/layout/components/layout-aside/index.vue

81 lines
2.2 KiB
Vue
Raw Normal View History

2022-04-08 02:42:44 +00:00
<template>
<div class="layout-aside">
<router-link to="/workbench" class="logo flex col-center">
2022-04-25 10:30:31 +00:00
<img class="logo-img" :src="config.webLogo" alt />
<div class="line-1">{{ config.webName }}</div>
2022-04-08 02:42:44 +00:00
</router-link>
<div class="scrollbar-wrap">
<el-scrollbar style="height: 100%" class="ls-scrollbar">
<el-menu
active-text-color="#fff"
background-color="#2a2c41"
:default-active="currentPath"
text-color="#E5E5E5"
>
<template v-for="(item, index) in sidebar" :key="index">
2022-04-25 10:30:31 +00:00
<sub-menu :route="item" :path="item.path" />
2022-04-08 02:42:44 +00:00
</template>
</el-menu>
</el-scrollbar>
</div>
</div>
</template>
<script lang="ts">
import { computed, defineComponent } from 'vue'
import { useAdmin } from '@/core/hooks/app'
import SubMenu from './sub-menu.vue'
export default defineComponent({
components: {
SubMenu
},
setup() {
const { store, route } = useAdmin()
const sidebar = computed(() => store.state.permission.sidebar)
2022-04-20 04:10:22 +00:00
const currentPath = computed(() => route.meta?.activeMenu ?? route.path)
2022-04-08 02:42:44 +00:00
const config = computed(() => store.getters.config)
return {
config,
sidebar,
currentPath
}
}
})
</script>
<style lang="scss" scoped>
.layout-aside {
height: 100%;
width: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
background-color: #2a2c41;
.logo {
height: $layout-header-height;
font-weight: 500;
font-size: 18px;
color: #fff;
padding: 0 20px;
.logo-img {
width: 30px;
height: 30px;
margin-right: 10px;
}
}
.scrollbar-wrap {
flex: 1;
min-height: 0;
.el-menu {
box-sizing: border-box;
padding: 10px 0 20px;
:deep(.el-menu-item) {
&.is-active {
background-color: $color-primary;
}
}
}
}
}
</style>