SideMenu.vue 2.11 KB
Newer Older
wb-ct393452's avatar
wb-ct393452 committed
1
<template>
2 3
    <a-layout-sider
        :theme="sideTheme"
4
        :class="['side-menu', 'beauty-scroll']"
5 6 7 8 9
        width="256px"
        :collapsible="collapsible"
        v-model="collapsed"
        :trigger="null"
    >
wb-ct393452's avatar
wb-ct393452 committed
10
        <div :class="['logo', theme]">
水落(YangLei)'s avatar
水落(YangLei) committed
11
            <router-link to="/">
12 13
                <img src="@/assets/img/logo.png" />
                <h1>{{ systemName }}</h1>
wb-ct393452's avatar
wb-ct393452 committed
14 15
            </router-link>
        </div>
水落(YangLei)'s avatar
水落(YangLei) committed
16
        <i-menu :theme="theme" :collapsed="collapsed" :options="menuData" class="menu" />
wb-ct393452's avatar
wb-ct393452 committed
17 18 19 20 21 22
    </a-layout-sider>
</template>

<script>
import IMenu from './menu';
import { mapState } from 'vuex';
23

wb-ct393452's avatar
wb-ct393452 committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
export default {
    name: 'SideMenu',
    components: { IMenu },
    props: {
        collapsible: {
            type: Boolean,
            required: false,
            default: false,
        },
        collapsed: {
            type: Boolean,
            required: false,
            default: false,
        },
        menuData: {
            type: Array,
            required: true,
        },
        theme: {
            type: String,
            required: false,
            default: 'dark',
        },
    },
    computed: {
        sideTheme() {
            return this.theme == 'light' ? this.theme : 'dark';
        },
52
        ...mapState('settingModule', ['systemName']),
wb-ct393452's avatar
wb-ct393452 committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
    },
};
</script>

<style lang="less" scoped>
.side-menu {
    min-height: 100vh;
    overflow-y: auto;
    z-index: 10;
    .logo {
        height: 64px;
        position: relative;
        line-height: 64px;
        padding-left: 24px;
        -webkit-transition: all 0.3s;
        transition: all 0.3s;
        overflow: hidden;
        background-color: @layout-trigger-background;
        &.light {
            background-color: #fff;
            h1 {
                color: @primary-color;
            }
        }
        h1 {
            color: @menu-dark-highlight-color;
            font-size: 20px;
            margin: 0 0 0 12px;
            display: inline-block;
            vertical-align: middle;
        }
        img {
            width: 32px;
            vertical-align: middle;
        }
    }
}
.menu {
    padding: 16px 0;
}
</style>