<template>
  <div class="title-box" :style="{ backgroundImage: titleImg }">
    <span>{{ title }}</span>
    <img
      v-if="hasMore"
      class="more"
      :src="require('@/assets/imgs/maps/icon_more.png')"
      alt=""
      @click="$emit('openMore')"
    />
  </div>
</template>

<script>
import TitleImg from '@/assets/imgs/panels/title_bg@2x.png'
export default {
  props: {
    title: {
      type: String,
      default: '',
    },
    hasMore: {
      type: Boolean,
      default: false,
    },
    longTitle: {
      type: Boolean,
      default: false,
    },
  },
  computed: {
    titleImg() {
      return `url(${TitleImg})`
    },
  },
}
</script>

<style lang="less" scoped>
.title-box {
  width: 100%;
  height: 42px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding-left: 28px;
  display: flex;
  align-items: center;
  position: relative;
  span {
    margin-left: 5px;
    //
    font-size: 15px;
    color: #ffffff;
    letter-spacing: 1px;
    font-weight: 700;
  }
  .more {
    width: 28px;
    height: 28px;
    position: absolute;
    top: 0;
    right: 20px;
    cursor: pointer;
  }
}
</style>
