<template>
  <div class="go-back-box">
    <div class="go-back">
      <div
        class="icon"
        @click="goBack"
      >
        <i class="el-icon-arrow-left"></i>
      </div>
      <p class="title">{{title}}</p>
      <div class="right-box">
        <slot name="right"></slot>
      </div>
    </div>
    <div
      v-if="bolder"
      class="divider"
    ></div>
  </div>
</template>

<script>
export default {
  name: 'GoBack',
  props: {
    title: {
      type: String,
      default: ''
    },
    bolder: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    goBack() {
      this.$router.go(-1);
    },
  }
}
</script>

<style lang="scss">
.go-back-box{
  background: #fff;
  z-index: 9;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;

  .go-back {
    height: 48px;
    line-height: 48px;
    box-sizing: border-box;
    z-index: 200;
    display: -webkit-flex;
    display: flex;

    .icon {
      width: 48px;
      height: 48px;
      padding-left: 30px;
      text-align: center;
      font-weight: 500;
      color: #2f2e3f;
      font-size: 20px;
      cursor: pointer;
    }

    .title{
      height: 48px;
      line-height: 48px;
      font-weight: 500;
      color: #2f2e3f;
      font-size: 15px;
      margin-left: 15px;
      cursor: pointer;
      flex: 1;
    }

    > .right-box{
      padding-right: 20px;
    }
    
  }

  .divider{
    height: 8px;
    width: 100vw;
    background: #F9FAFC;
  }
}

</style>
