<template>
  <div class="nav" :style="{ background: color }">
    <img class="nav_left_icon" src="@/assets/common/back_icon.png" alt @click="back" />
    <slot name="middle">
      <p class="nav_title">{{ title }}</p>
    </slot>
    <slot name="right"></slot>
  </div>
</template>

<script>
export default {
  name: "NavHeader",
  props: {
    title: {
      type: String,
      default: "镇合意",
    },
    color: {
      type: String,
      default: "#F3654A",
    },
  },
  methods: {
    back() {
      this.$emit("back");
    },
  },
};
</script>

<style lang="stylus" scoped>
.nav {
  position: relative;
  width: 100%;
  height: 88px;
  background: #F3654A;

  .nav_left_icon {
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    margin: auto;
    width: 40px;
    height: 41px;
  }

  .nav_title {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    max-width: 80%;
    margin: auto;
    text-align: center;
    line-height: 88px;
    font-size: 36px;
    color: #FFFFFF;
  }
}
</style>
