<template>
  <view class="header">
    <view class="headbox">
      <wd-icon
        v-if="showBack"
        class="icon"
        name="thin-arrow-left"
        color="#333333"
        size="18px"
        @click="handleBack"
      ></wd-icon>
      <view class="title">{{ props.title }}</view>
    </view>
  </view>
</template>

<script setup>
const props = defineProps({
  title: {
    type: String,
    default: '',
  },
  showBack: {
    type: Boolean,
    default: true,
  },
});
const handleBack = () => {
  uni.navigateBack();
};
</script>

<style lang="scss" scoped>
.header {
  height: 88rpx;
  background-color: #ffffff;
  position: fixed;
  z-index: 999;
  width: 375 * 2rpx;
  top: 0;

  .headbox {
    display: flex;
    align-items: center;
    height: 100%;
    width: 100%;

    .icon {
      padding: 0 20rpx;
    }

    .title {
      text-align: center;
      width: 100%;
      transform: translate(-18px);
      font-size: 36rpx;
      font-family: PingFang SC;
      color: #333333;
    }
  }
}
</style>
