wupengfei
8 天以前 6bbbb4b915db008caa570774b3acc7922fbc3abf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
  <div class="data-board-center-data-item">
    <div class="data-board-data-info-item-icon">
      <img :src="image" alt="" />
    </div>
    <div class="data-board-data-info-item-content">
      <div class="data-board-data-info-item-value">
        <el-statistic :value="_value" :precision="precision" />
      </div>
      <div class="data-board-data-info-item-label">{{ label }}</div>
    </div>
  </div>
</template>
 
<script setup lang="ts">
import { useTransition } from '@vueuse/core';
 
defineOptions({
  name: 'DataBoardCenterDataItem',
});
 
type Props = {
  image: string;
  label: string;
  precision?: number;
};
 
const props = withDefaults(defineProps<Props>(), {
  precision: 2,
});
 
const value = defineModel<number>('value');
 
const _value = useTransition(value, {
  duration: 500,
});
</script>
 
<style lang="scss" scoped>
@use '@/style/common.scss' as *;
 
.data-board-center-data-item {
  display: flex;
  padding: 8px 12px;
  background: rgba(0, 5, 18, 0.27);
 
  .data-board-data-info-item-icon {
    width: 64px;
    height: 64px;
 
    img {
      width: 100%;
      height: 100%;
    }
  }
 
  .data-board-data-info-item-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    margin-left: 10px;
 
    .data-board-data-info-item-value {
      margin-bottom: 5px;
      font-size: 22px;
      font-family: DrukWide-Bold;
      line-height: 30px;
 
      :deep() {
        .el-statistic__content {
          color: #ffffff;
        }
      }
    }
 
    .data-board-data-info-item-label {
      font-size: 16px;
      line-height: 22px;
      color: #ffffff;
    }
  }
}
</style>