StatisticBox.vue 1.62 KB
<!--
 * @Description: 
 * @Author: huyue
 * @Date: 2024-01-26 11:36:05
 * @LastEditors: huyue
 * @LastEditTime: 2024-07-10 14:27:55
-->
<template>
  <div class="statistics">
    <div class="statistics-item" v-for="(item, index) in list" :key="index" :style="{ width: 100 / list.length + '%' }">
      <div class="statistics-top">
        <div class="statistics-name">{{ item.name }}</div>
        <div class="statistics-text">
          {{ numAddSymbol(item.value) }}
          <span class="statistics-unit">{{ item.unit }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'StatisticsBox',
  props: {
    list: {
      type: Array
    }
    // bottomType: {
    //   type: String,
    //   default: 'default'
    // }
  },
  data() {
    return {}
  },

  mounted() {},

  methods: {}
}
</script>

<style lang="scss" scoped>
.statistics {
  display: flex;
  height: 8.15vh;
  &-item {
    width: 10.26vw;
    padding: 1.48vh 2.41vw;
    box-sizing: border-box;
    margin-right: 0.42vw;
    background-image: url(../../../assets/images/statistic-bg.png);
    background-size: 100% 100%;
    &:last-child {
      margin-right: 0;
    }
  }
  &-name {
    font-weight: 500;
    font-size: 14px;
    color: #e8e8e8;
  }
  &-text {
    font-weight: 600;
    font-size: 18px;
    background: linear-gradient(to right, #01a4f9, #6df5f9); /* 从左到右渐变 */
    -webkit-background-clip: text; /* Safari/Chrome支持该属性 */
    color: transparent; /* 将文本颜色设置为透明 */
    margin-top: 1.1vh;
    .statistics-unit {
      font-size: 12px;
      margin-left: 0.52vw;
    }
  }
}
</style>