<template>
  <div class="narBarContainer" :class="{ border: border }">
    <cr-icon type="arrow-left" class="arrow navigator" @click="navigateBack" />
    <div class="title">
      {{ title }}
    </div>
  </div>
</template>
<script>
export default {
  props: {
    border: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      title: ''
    };
  },
  created() {
    // console.log(this.$route);
    this.title = this.$route.meta.title || '';
  },
  methods: {
    navigateBack() {
      this.$router.go(-1);
    }
  }
};
</script>
<style scoped lang="less">
.narBarContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 44px;
  background: @white;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  &.border {
    border-bottom: 1px solid @grey-border;
  }
  .navigator {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: @gray-3;
  }
  .title {
    .text-size(17);
    color: #333333;
    letter-spacing: -0.41px;
  }
}
</style>
