StatisticsBox.vue
3.61 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<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-price"><span class="statistics-unit" v-if="item.unitType == 'left'">{{item.unit}}</span><span class="statistics-price-number">{{numAddSymbol(item.value)}}</span><span v-if="item.unitType == 'right'">{{item.unit}}</span></div>
<div v-if="item.rate" class="statistics-top-rate">占比<span>{{item.rate}}%</span></div>
</div>
<div class="statistics-bottom" v-if="item.bottomLabel || item.bottomType">
<template v-if="item.bottomType == 'money'">
<span> {{item.bottomLabel}}</span>
<span>¥{{numAddSymbol(item.bottomValue)}}</span>
</template>
<template v-else-if="item.bottomType == 'slot'">
<slot :name="item.valueName" :[item.valueName]="item"></slot>
</template>
<template v-else-if="item.bottomType == 'ratio'">
<div class="ratio">
<div class="ratio-left">{{item.ratioLeftLabel}}<span :class="item.ratioLeftValue > 0 ? 'positive' : 'negative'">{{item.ratioLeftValue}}%</span></div>
<div class="ratio-right">{{item.ratioRightLabel}}<span :class="item.ratioRightValue > 0 ? 'positive' : 'negative'">{{item.ratioRightValue}}%</span></div>
</div>
</template>
<template v-else>
<span>{{item.bottomLabel}}</span>
<span>{{numAddSymbol(item.bottomValue)}}</span>
</template>
</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;
color: #fff;
height: 11.78vh;
&-item {
padding: 0.89vh 0.53vw;
margin-right: 1.11vw;
background: rgba(11, 44, 142, 0.28);
// box-shadow: inset 0 0 20px 0 #3d57ff69;
&:last-child {
margin-right: 0;
}
}
&-top {
position: relative;
padding-left: 0.3vw;
&-rate {
position: absolute;
right: 0;
top: 0;
font-size: 12px;
color: #95ACD9;
span {
color: #EB6001;
}
}
}
&-name {
font-weight: 500;
font-size: 14px;
margin-bottom: 0.89vh;
height: 2.22vh;
}
&-unit {
padding-right: 0.56vw;
}
&-price {
display: flex;
align-items: center;
color: #25D6FF;
font-weight: 600;
font-size: 14px;
height: 3.11vh;
&-number {
padding-right: 0.56vw;
font-size: 20px;
color: #5894FF;
background-image:-webkit-linear-gradient(left,#24D8FF,#7787FF);
-webkit-background-clip:text;
-webkit-text-fill-color:transparent;
}
}
&-bottom {
display: flex;
justify-content: space-between;
font-size: 12px;
color: #95ACD9;
border-top: 1px solid #2A3D72;
padding: 0.89vh 0.3vw 0;
margin-top: 0.89vh;
.ratio {
display: flex;
width: 100%;
justify-content: space-between;
.positive,
.negative{
display: inline-block;
margin-left: 0.28vw;
}
.positive {
color: #EB6001;
}
.negative {
color: #16E193;
}
}
}
}
</style>