he wei
2024-09-21 70edda3b00f2528a473c28ec5a50b739ed160f0f
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<template>
  <div class="paramModule">
    <div class="param-right">
      <div class="param-circle-wrapper" ref="paramCircle"></div>
    </div>
    <div class="param-left">
      <div class="title">{{ name }}</div>
      <div class="dataCon">{{ value }}{{ unit }}</div>
    </div>
  </div>
</template>
 
<script>
import ParamCircle from "../js/ParamCircle";
 
export default {
  props: {
    name: {
      type: String,
      default: "",
    },
    value: {
      type: Number,
      default: 0,
    },
    unit: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      paramCirle: "",
    };
  },
  methods: {
    resize() {
      this.$nextTick(() => {
        this.paramCirle.resize();
      });
    },
  },
  mounted() {
    this.paramCirle = new ParamCircle(this.$refs.paramCircle);
    window.addEventListener("resize", this.resize);
  },
  destroyed() {
    window.removeEventListener("resize", this.resize);
  },
};
</script>
 
<style scoped>
.paramModule * {
  box-sizing: border-box;
}
 
.paramModule {
  display: flex;
  justify-items: center;
  align-items: center;
}
 
.param-right {
  width: 110px;
  height: 110px;
  display: flex;
  justify-items: center;
  align-items: center;
  position: relative;
}
 
.param-circle-wrapper {
  width: 100%;
  height: 100%;
}
 
.param-left {
  width: 180px;
  height: 80px;
  background-color: #00fefe;
  border-radius: 0 30px 30px 0;
  border: 2px solid #fa884c;
  margin-left: -40px;
  padding-left: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
 
.param-left .title {
  font-size: 14px;
  font-weight: bold;
  color: #00253f;
}
 
.param-left .dataCon {
  display: inline-block;
  min-width: 50px;
  font-size: 22px;
  text-align: center;
  color: #fa884c;
  padding: 4px 16px;
  background-color: #00253f;
  margin-top: 4px;
}
</style>