<template>
  <div class="header-box">
    <div class="back" @click="$emit('back')" v-if="showBack">
      <i class="el-icon-arrow-left"/>
    </div>
    <div class="title">
      {{title}}
    </div>
    <div class="content">
      <slot/>
    </div>
  </div>
</template>

<script>
export default {
  name: "EditHeader",
  props: {
    title: {
      type: String,
      default: null
    },
    showBack: {
      type: Boolean,
      default: false,
    }
  }
}
</script>

<style lang="scss" scoped>
.header-box {
  width: 100%;
  height: 48px;
  background-color: #fff;
  line-height: 48px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid #f1f1f1;
  display: flex;
  .back {
    padding: 0 1em;
    transition: .25s;
    cursor: pointer;
  }
  .back:hover {
    background-color: #f1f1f1;
  }
  .title {
    margin:0 20px;
  }
  .content {
    flex: 1;
    height: 100%;
    display: flex;
    padding-right: 20px;
    justify-content: flex-end;
    align-items: center;
  }
}
</style>
