<template>
  <div class="list-item-header" :class="overflowHidden ? 'overflow-hidden' : ''">
    <slot name="tag" />
    <slot name="title">
      <span v-if="isTag" class="list-item-header-title-tag list-item-header-title">{{ title }}</span>
      <span v-else class="list-item-header-title">{{ title }}</span>
    </slot>
    <slot name="rightTag" />
  </div>
</template>
<script>
export default {
  name: 'rtItemHeader',
  props: {
    title: {
      type: String,
      default: ''
    },
    isTag: {
      type: Boolean,
      default: false
    },
    // 超出部分显示...
    overflowHidden: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    hasTag() {
      return !!this.tag;
    },
    hasStatus() {
      return !!this.status;
    }
  }
};
</script>

<style lang="less">
.list-item-header {
  color: #222;
  line-height: 30px;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;

  .list-item-header-title-tag {
    margin-right: 5px;
    text-overflow: ellipsis;
    max-width: 68vw;
    white-space: nowrap;
    overflow: hidden;
  }
  &.overflow-hidden {
    .list-item-header-title {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      max-width: 70%;
    }
  }
}
</style>
