Price.vue
1.82 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
<template>
<div class="user-box">
<div class="title-icon">
<span class="title-bg">车价占比</span>
</div>
<div class="user-container flex">
<pie-chart @pieAction="pieAction" ref="pieChart" :formatter="chart.formatter" :colors="chart.colors" :size="chart.size" :id="chart.id" :list="priceData" :keys="chart.keys" :radius="chart.radius" height="6.1vh"></pie-chart>
<div class="legend-item flex">
<span :style="{ background: descColor }"></span>
{{ selectData && selectData.name }}
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Price',
data() {
return {
selectData: '',
descColor: '',
chart: {
id: 'user-price',
keys: ['name', 'num'],
radius: ['56%', '85%'],
colors: ['#FF6E76', '#16E193', '#FDF006', '#EB6001', '#34AFFF', '#BF98FF', '#726BFF'],
size: '8px',
formatter: 'rate'
},
priceData: []
}
},
created() {
this.$bus.$on('userData', data => {
this.priceData = data.priceData
})
},
methods: {
pieAction(data) {
this.descColor = this.$refs.pieChart.descColor
this.selectData = data
}
}
}
</script>
<style lang="scss" scoped>
.user-box {
.title-icon {
font-weight: 500;
font-size: 10px;
color: #ffffff;
.title-bg {
background-image: linear-gradient(90deg, #003f57 0%, #111056 54%, #071735 100%);
padding-left: 0.83vw;
}
}
.legend-item {
width: 4.65vw;
height: 1.83vh;
background: #0A214D;
font-weight: 400;
font-size: 9px;
color: #fff;
margin-right: 2vw;
span {
width: 5px;
height: 5px;
border-radius: 50%;
margin: 4px;
display: inline-block;
}
}
}
</style>