<!-- 单个图片 图例 -->
<template>
  <div class="box">
    <div class="box-title title">
      {{ dataSource.title }}
    </div>
    <div style="width: auto; height: 50px; position: relative; display: flex">
      <img class="box-img" :src="dataSource.url" />
      <div
        class="box-type"
        :style="{
          fontSize: dataSource.type === '二氧化碳' ? '8px' : '10px',
        }">
        {{ dataSource.type }}</div
      >
      <div
        class="box-number"
        :style="{
          left: dataSource.type === '二氧化碳' ? '95px' : '90px',
        }"
        >{{ dataSource.number }}</div
      >
      <div v-if="dataSource?.unit" class="box-unit"> {{ dataSource.unit }}</div>
      <div style="position: absolute; bottom: -16px">
        <img style="width: 12px" src="../image/airConditioningSystem/triangle.png" />
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
  defineProps({
    dataSource: {
      type: Object,
      default: () => {
        return { title: '' };
      },
    },
  });
</script>
<style lang="less" scoped>
  .box {
    min-width: 100px;
    width: auto;
    height: 80px;
    background-color: #213479;
    border-radius: 0px 4px 4px 0px;
    border-left: 4px solid #0dffff;
    padding: 8px 0px;
    .title {
      position: relative;
      padding-left: 9px;
      &::before {
        content: '';
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        height: 10px;
        width: 2.5px;
        border-radius: 1px;
        background-color: #0dffff;
      }
    }
    .box-title {
      width: 100%;
      height: 20px;
      font-size: 12px;
      color: #0dffff;
      padding: 0px 20px;
    }
    .box-img {
      position: absolute;
      transform: translateY(-50%);
      top: 50%;
      width: 35px;
      height: 35px;
      left: 10px;
    }
    .box-type {
      height: 20px;
      color: white;
      font-size: 10px;
      left: 50px;
      top: 53%;
      width: auto;
      height: 100%;
      line-height: 50px;
      margin-left: 50px;
      min-width: 30px;
      margin-right: 4px;
    }
    .box-number {
      color: #0dffa4;
      font-size: 18px;
      left: 72%;
      top: 45%;
      width: auto;
      text-align: center;
      font-weight: bold;
      box-sizing: border-box;
      font-style: italic;
      width: auto;
      height: 100%;
      line-height: 48px;
      min-width: 20px;
    }
    .box-unit {
      color: white;
      font-size: 8px;
      top: 53%;
      min-width: 20px;
      width: auto;
      height: 100%;
      line-height: 55px;
      margin-left: 5px;
      text-align: center;
      margin-right: 8px;
    }
  }
</style>
