<template>
  <div class="target-group">
    <div class="target" :style="{ width: `${100 / dataList.length}%` }" v-for="(el, index) in dataList" :key="index">
      <div class="target-label">
        {{ el.label }}
        <el-tooltip v-if="el.tips" placement="top" popper-class="target-tooltip">
          <div slot="content" v-html="el.tips" style="max-width: 450px"></div>
          <i class="iconfont icon-QuestionCircleOutlined target-label-icon"></i>
        </el-tooltip>
      </div>
      <div class="target-value">
        {{ el.value }}<span v-if="el.unit" class="target-value-unit">{{ el.unit }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'TargetGroup',
  props: {
    dataList: {
      type: Array,
      default: () => []
    }
  }
};
</script>

<style lang="scss" scoped>
.target-group {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  margin-top: 16px;
  padding: 20px;
  width: 100%;
  min-width: 265px;
  background: #f7f8fa;
  border-radius: 4px;
  box-sizing: border-box;
  .target {
    flex-shrink: 0;
    .target-label {
      font-size: 14px;
      font-weight: 400;
      color: #606266;
      line-height: 20px;
      .target-label-icon {
        font-size: inherit;
      }
    }
    .target-value {
      display: flex;
      justify-content: flex-start;
      align-items: flex-end;
      margin-top: 8px;
      font-size: 24px;
      font-family: DIN Alternate-Bold, DIN Alternate;
      font-weight: bold;
      color: #303133;
      line-height: 28px;
      .target-value-unit {
        font-size: 14px;
        line-height: 25px;
        font-weight: 600;
      }
    }
  }
}
</style>
