<template>
  <lu-container style="height: 100%;">
    <lu-aside :class="`asideMain ${menuExpand ? 'large' : 'small'}`">
      <div class="asideHeader">
        <img class="logoImg" src="@/assets/img/logo.png" />
        <transition name="slide-fade">
          <img
            class="logoWordImg"
            v-if="menuExpand"
            src="@/assets/img/word.png"
          />
        </transition>
        <div class="asidebtn">
          <img
            @click="packUp"
            v-if="menuExpand"
            src="@/assets/img/arrow_left.png"
          />
          <img
            @click="expand"
            v-if="!menuExpand"
            src="@/assets/img/arrow_right.png"
          />
        </div>
      </div>
      <lu-menu
        style="min-height: 100%"
        :default-active="$route.path"
        class="el-menu-vertical-demo"
        :collapse="isCollapse"
      >
        <lu-submenu index="1">
          <template slot="title">
            <img class="icon-img" src="@/assets/img/user.png" alt="" />
            <span slot="title">组件demo</span>
          </template>
          <lu-menu-item-group>
            <span v-show="false" slot="title">分组一</span>
            <!-- <lu-menu-item
              @click="$router.push('Markdown')"
              style="padding-left: 88px"
              index="/Markdown"
            >
              <span class="item-border">
                markdown组件
              </span>
            </lu-menu-item> -->
            <lu-menu-item
              @click="$router.push('DragSelect')"
              style="padding-left: 88px"
              index="/DragSelect"
            >
              <span class="item-border">
                可拖动select
              </span>
            </lu-menu-item>
            <lu-menu-item
              @click="$router.push('TableSelected')"
              style="padding-left: 88px"
              index="/TableSelected"
            >
              <span class="item-border">
                表格选择组件
              </span>
            </lu-menu-item>
            <lu-menu-item
              @click="$router.push('BatchInput')"
              style="padding-left: 88px"
              index="/BatchInput"
            >
              <span class="item-border">
                批量Input处理业务组件
              </span>
            </lu-menu-item>
            <lu-menu-item
              @click="$router.push('UploadFile')"
              style="padding-left: 88px"
              index="/UploadFile"
            >
              <span class="item-border">
                基本上传组件
              </span>
            </lu-menu-item>
          </lu-menu-item-group>
        </lu-submenu>
      </lu-menu>
    </lu-aside>
    <lu-container>
      <!-- <lu-header class="main-header">
        <div class="user-logo">
          <img
            slot="reference"
            class="logo-img"
            src="@/assets/img/userlogo.png"
            alt=""
          />
          <span class="logo-word">欢迎访问</span>
        </div>
      </lu-header> -->

      <lu-main class="main-container">
        <router-view></router-view>
      </lu-main>
    </lu-container>
  </lu-container>
</template>

<script>
export default {
  data() {
    return {
      menuExpand: true, //默认展开
      isCollapse: false
    };
  },
  async mounted() {},
  methods: {
    packUp() {
      this.isCollapse = true;
      this.menuExpand = false;
    },
    expand() {
      this.isCollapse = false;
      this.menuExpand = true;
    },
    logout() {
      this.$router.push({
        name: "login"
      });
    }
  }
};
</script>

<style lang="stylus">
.el-popover{
  min-width 50px!important
}
.el-menu-item-group__title {
  display: none;
}
.icon-img {
  padding-left: 40px;
  width: 18px;
  height: 18px;
  margin-right: 10px;
}

.arrow-right {
  width: 20px;
  height: 20px;
  // float: right;
}
.el-main {
  background-color: #fff;
  padding: 0 !important;
}
.el-submenu__title i {
  position: relative;
  top: 4px;
  right: -60px;
  color: #fff !important;
  font-size: 14px;
}
.el-submenu .el-menu-item {
  padding-left: 40px;
  color: #a5bcff;
  .item-border {
    padding-bottom: 10px;
    border-bottom: 1px solid #2e4075;
  }
}
.is-active {
  color: #a5bcff;
}
.user-logo {
  text-align: right;
  padding-right: 10%;
  padding-top: 14px;
  .logo-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    vertical-align: middle;
  }
  .logo-word {
    font-family: PingFangSC-Regular;
    font-size: 12px;
    color: #666666;
    margin-left: 5px;
    display: inline-block;
  }
}

.main-header {
  box-shadow: 0 2px 6px 0 rgba(189, 189, 189, 0.2);
  margin-bottom: 6px;
}
.asideMain.large{
  // transition:0.3s
  width: 294px!important
  .asideHeader{
    background: #1d2b56;
    border-right: solid 1px #e6e6e6;
    padding: 20px;
    height: 25px;
    text-align: center;
    .logoImg{
      width 35px
      padding-right:5px
    }
    .logoWordImg{
      width 70px
      opacity 1
    }
    .asidebtn{
      display: inline-block;
      float right
      img{
        width 20px
      }
    }
  }
  .el-menu--collapse{
    width:auto!important
  }
  .el-menu-vertical-demo {
    min-height: calc(100% - 65px)!important;
  }
}
.asideMain.small{
  transition:0.5s
  width: 80px!important
  .asideHeader{
    background: #1d2b56;
    border-right: solid 1px #e6e6e6;
    padding: 20px 10px;
    text-align: center;
    .logoImg{
      width 30px
      padding-right:5px
    }
    .logoWordImg{
      width 70px;
      // opacity 0
      display none
    }
    .asidebtn{
      display: inline-block;
      float right
      img{
        width 20px
      }
    }
  }
  .el-menu--collapse{
    width:auto!important
  }
  .el-menu-vertical-demo {
    // width: 79px;
    min-height: calc(100% - 65px)!important;
  }
  .el-menu .icon-img{
    padding-left: 5px;
    width: 17px;
    height: 17px;
  }

  // .el-submenu__title span{
  //   display none
  // }
}
//收起菜单hover
.el-menu--vertical{
  .el-menu-item-group ul:after{
    content ''
    position absolute
    border-bottom: 8px solid transparent;
    border-right: 8px solid #4F5A7A;
    border-top: 8px solid transparent;
    border-left: 8px solid transparent;
    top 30px
    left -14px
    z-index -1
  }
  .el-menu:after{
    border-right-color:#4F5A7A
    brder-left-width:0
  }
  .el-menu-item{
    padding-left 10px!important
    padding:0 10px
    height 45px
    line-height 45px
  }
  .el-menu-item:hover{
    background:#788ABD
  }
  .el-menu-item.is-active {
    color #fff
    // background:#4F5A7A
  }
  .el-menu--popup{
    min-width 50px
  }
  .el-menu{
    background-color #4F5A7A
  }
}

.slide-fade-enter-active {
  transition: all .3s ease;
}
.slide-fade-leave-active {
  // opacity: 0;
  transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.slide-fade-enter, .slide-fade-leave-to
/* .slide-fade-leave-active for below version 2.1.8 */ {
  // transition: all .3s ease;
  transform: translateX(150px);
  // opacity: 0;
}
</style>
