<template>
  <el-scrollbar wrap-class="scrollbar-wrapper">
    <div class="logo">
      <!-- <img class="logo_img" src="../../../../assets/imgs/logo.png" alt="logo"> -->
      <!-- <transition name="el-fade-in-linear"> -->
      <h1 v-show="sidebar.opened" class="title">足力健老人鞋</h1>
      <!-- </transition> -->
    </div>
    <hamburger
      :toggle-click="toggleSideBar"
      :is-active="sidebar.opened"
      class="hamburger-container"
    />
    <el-menu
      :show-timeout="200"
      :default-active="$route.path"
      :collapse="isCollapse"
      mode="vertical"
      background-color="#333744"
      text-color="#ffffff"
      active-text-color="#409EFF"
      unique-opened
    >
      <sidebar-item :routes="permission_routers" />
    </el-menu>
  </el-scrollbar>
</template>

<script>
import { mapGetters } from 'vuex'
import SidebarItem from './SidebarItem'
import Hamburger from '@/components/Hamburger'

export default {
  components: { SidebarItem, Hamburger },
  computed: {
    ...mapGetters([
      'permission_routers',
      'sidebar'
    ]),
    isCollapse () {
      return !this.sidebar.opened
    }
  },
  methods: {
    toggleSideBar () {
      this.$store.dispatch('ToggleSideBar')
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss">
.logo {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10;
  width: 180px;
  height: 52px;
  line-height: 52px;
  background-color: #373d41;
  color: #ffffff;
  text-align: center;
  border-right: 1px solid #2a2f32;
  overflow: hidden;
  .logo_img {
    display: inline-block;
    vertical-align: middle;
    width: 17px;
    height: 20px;
  }
  .title {
    margin-top: 0;
    margin-bottom: 0;
    margin-left: 12px;
    display: inline-block;
    vertical-align: middle;
    font-size: 20px;
    font-family: "microsoft yahei" 微软雅黑;
  }
}
</style>

