<template>
  <div class="left-wrapper">
    <div class="base-panel-left" :class="{ hide: isHide }">
      <slot></slot>
      <div class="leftbtn" @click="toggleLeftPanel"></div>
      <div class="left-background" :class="{ leftHide: isHide }"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'BasePanelLeft',
  data() {
    return {
      isHide: false
    }
  },
  methods: {
    toggleLeftPanel() {
      console.log('切换左侧面板')
      this.isHide = !this.isHide
    }
  }
}
</script>

<style lang="scss" scoped>
.left-wrapper {
  .base-panel-left {
    position: absolute;
    top: 0px;
    left: 0;
    height: 100vh;
    width: 4.62rem;
    padding-top: 0.82rem;
    padding-left: 0.12rem;
    transition: all 0.3s;
    pointer-events: auto;
    z-index: 40;

    .leftbtn {
      pointer-events: none;
      display: block;
      width: 0.7rem;
      height: 100%;
      text-align: center;
      font-size: 0.2rem;
      position: absolute;
      top: 0;
      right: 0;
      z-index: 88;
      background: url('@/assets/image/common/left_hide.png') no-repeat left center / 100% 100%;
      &::after {
        content: '';
        position: absolute;
        right: 0.1rem;
        top: 45%;
        width: 0.3rem;
        height: 2.4rem;
        pointer-events: auto;
        cursor: pointer;
      }
    }
    .left-background {
      position: absolute;
      transition: all 0.3s;
      pointer-events: none;
      width: 6.5rem;
      height: 100%;
      top: 0;
      left: 0;
      background: url('@/assets/image/common/dataCenterLeftBg.png') no-repeat 0 0 / 100%;
    }
  }
  .hide {
    transform: translateX(-5rem);
    .leftbtn {
      right: -1.08rem;
      background: url('@/assets/image/common/left_show.png') no-repeat left center / 100% 100%;
    }
    div {
      overflow: hidden;
    }
  }
}
</style>
