<template>
  <div class="base-header">
    <slot name="title" v-if="$slots.title"></slot>
    <span v-else class="title">{{ title }}</span>
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: 'BaseHeader',
  props: {
    title: { type: String, default: '' }
  }
}
</script>

<style lang="scss" scoped>
.base-header {
  position: relative;
  padding: px-to-rem(0) px-to-rem(12) px-to-rem(0) px-to-rem(45);
  width: px-to-rem(368);
  height: px-to-rem(48);
  line-height: px-to-rem(48);
  color: #fff;
  font-size: px-to-rem(18);
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  background-size: cover;
  background-image: url('@/assets/image/common/header-bg.png');
  .title {
    position: relative;
    overflow: hidden;
    padding: 0 0.08rem;
    width: 100%;
    height: 0.48rem;
    color: #ffffff;
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
  }
}
</style>
