<script setup>
const colors = ["#31b48d", "#38a1f2", "#7538c7", "#3b67a4"];

const prop = defineProps({
  //   统计数据列表
  list: {
    type: Array,
    default: () => [],
  },
});
</script>

<template>
  <div class="statistics-panel">
    <div
      v-for="(item, index) in list"
      :style="{
        backgroundColor: colors[index % colors.length],
      }"
      class="statistics-item"
    >
      <div class="left">
        <div class="label">
          {{ item.label }}
        </div>
        <div class="value">
          {{ item.value }}
        </div>
        <div class="unit">
          {{ item.unit }}
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.statistics-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;

  .statistics-item {
    width: 24%;
    height: 140px;
    margin-bottom: 20px;
    border-radius: 5px;
    background-color: #fff;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #fff;
    position: relative;

    .left {
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;

      .label {
        font-size: 16px;
        //color: #333;
        //margin-bottom: 10px;
      }

      .value {
        font-size: 24px;
        //color: #333;
        font-weight: bold;
      }

      .unit {
        font-size: 16px;
        //color: #333;
      }
    }

    .icon {
      position: absolute;
      top: 10px;
      right: 10px;
      font-size: 20px;
      //color: #333;
      cursor: pointer;
    }
  }
}
</style>
