| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <div>
- <div
- :class="{ 'has-logo': showLogo, }"
- :style="{
- backgroundColor:
- settings.sideTheme === 'theme-dark' ? '#133f6f' : '#ffffff',
- }"
- >
- <logo v-if="showLogo" :collapse="isCollapse" />
- <div class="scro">
- <el-scrollbar :class="settings.sideTheme" style="height: 100%" wrap-class="scrollbar-wrapper">
- <el-menu
- :default-active="activeMenu"
- :collapse="isCollapse"
- :background-color="
- settings.sideTheme === 'theme-dark' ? '#133f6f' : '#ffffff'
- "
- :text-color="
- settings.sideTheme === 'theme-dark' ? '#bfcbd9' : '#182c4e'
- "
- :unique-opened="true"
- :active-text-color="settings.theme"
- :collapse-transition="false"
- mode="vertical"
- >
- <sidebar-item
- v-for="(route, index) in sidebarRouters"
- :key="route.path + index"
- :item="route"
- :base-path="'/' + route.path"
- />
- </el-menu>
- </el-scrollbar>
- </div>
- <div class="bottomBox" :style="{ backgroundColor: settings.sideTheme === 'theme-dark' ? '#133f6f' : '#ffffff' }">
- <hamburger
- id="hamburger-container"
- :is-active="sidebar.opened"
- class="hamburger-container"
- @toggleClick="toggleSideBar"
- />
- </div>
- </div>
- </div>
- </template>
- <script>
- import { mapGetters, mapState } from "vuex";
- import Logo from "./Logo";
- import SidebarItem from "./SidebarItem";
- import Hamburger from "@/components/Hamburger";
- export default {
- components: { SidebarItem, Logo, Hamburger },
- computed: {
- ...mapState(["settings"]),
- ...mapGetters(["sidebarRouters", "sidebar"]),
- activeMenu() {
- const route = this.$route;
- const { meta, path } = route;
- // if set path, the sidebar will highlight the path you set
- if (meta.activeMenu) {
- return meta.activeMenu;
- }
- return path;
- },
- showLogo() {
- return this.$store.state.settings.sidebarLogo;
- },
- isCollapse() {
- return !this.sidebar.opened;
- },
- },
- mounted(){
- console.log(this.sidebarRouters,'sidebarRouters');
- },
- methods: {
- toggleSideBar() {
- this.$store.dispatch("app/toggleSideBar");
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .hamburger {
- margin-bottom: -1px;
- width: 100%;
- height: 100%;
- background-color: #133f6f;
- }
- .scro {
- position: relative;
- height: 90vh;
- width: 100%;
- overflow-y: auto !important;
- }
- .bottomBox {
- position: relative;
- height: 10vh;
- width: 100%;
- //margin-top: 10px;
- padding-left: 10px;
- color: #FFFFFF;
- bottom: 1%;
- border-top: #ccc;
- .hamburger-container {
- // text-align: center;
- cursor: pointer;
- transition: background 0.3s;
- -webkit-tap-highlight-color: transparent;
- &:hover {
- background: rgba(0, 0, 0, 0.025);
- }
- }
- }
- </style>
|