<template>
    <el-scrollbar class="layout-menu" :class="{ collapse: collapseAside }">
        <div class="title">马士兵严选后台管理平台</div>
        <el-divider>{{ activeAsideName }}</el-divider>
        <el-menu unique-opened router :default-active="activeMenu">
            <MenuItem v-for="(item, index) in menuList" :key="index" :menu-item="item" />
        </el-menu>
    </el-scrollbar>
</template>

<script setup>
    import MenuItem from './menu-item.vue';
    const store = useStore();
    const activeAsideName = computed(() => store.getters['layout/activeAsideName']);
    const menuList = computed(() => store.state.layout.menuList);
    const activeMenu = computed(() => store.state.layout.activeMenu);
    const collapseAside = computed(() => store.getters['layout/collapseAside']);
</script>

<style lang="less" scoped>
    .layout-menu {
        flex: 1;
        width: @layout-menu-width;
        height: 100%;
        background-color: @layout-menu-bgc;
        box-shadow: @layout-shadow;
        padding: 0 @layout-space;
        transition: width 0.3s;
        &.collapse {
            width: 0;
            padding: 0;
            overflow: hidden;
            :deep(*) {
                opacity: 0;
                transition: opacity 0.3s;
            }
        }
        .title {
            width: 100%;
            height: @layout-header-height;
            line-height: @layout-header-height;
            font-size: @layout-h2;
            color: @layout-menu-active-fc;
            text-align: center;
            .text-overflow();
        }
        .el-divider {
            margin: 0 0 @layout-space-super 0;
            border-color: @color-ghost-white;
            :deep(.el-divider__text) {
                color: @layout-menu-active-fc;
                background-color: @layout-menu-bgc;
            }
        }
        :deep(.el-scrollbar__view) {
            height: 100%;
            .el-menu {
                --el-menu-bg-color: transparent;
                --el-menu-text-color: @layout-menu-fc;
                --el-menu-hover-bg-color: @layout-menu-hover-bgc;
                border-right: none;
            }
        }
    }
</style>
