<template>
  <div class="title" :class="{error: type === 'error', warning: type === 'warning'}">
    <div>
      <span v-for="(item, index) in data" :key="index">
        <span>{{item.name}}</span>
        <b>{{item.num}}</b>
      </span>
    </div>
    <slot/>
  </div>
</template>
<script>
export default {
  props: {
    type: {
      type: String,
      default: 'warning'
    },
    data: {
      type: Array,
      default: []
    }
  }
}
</script>
<style lang="less" scoped>
.title{
  height: 48px;
  line-height: 48px;
  background-color: rgba(0, 0, 0, .02);
  overflow: hidden;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  padding-right: 10px;
  font-weight: bold;
  b{
    font-size: 18px;
  }
  &.error {
    b{
      color: #ED6F62;
    }
    &:before{
      background-color: #ED6F62;
    }
  }
  &.warning {
    b{
      color: #F2A24A;
    }
    &:before{
      background-color: #F2A24A;
    }
  }
  &:before{
      content: '';
      display: block;
      position: absolute;
      width: 7px;
      height: 48px;
      left: 0;
    }
  >div{
    position: relative;
    padding-left: 20px;
    font-size: 14px;
    >span{
      margin-right: 10px;
      display: inline-block;
    }
  }
}
</style>
