Legend.vue
1.36 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
<template>
<div class='legend'>
<div class='legend-item flex' v-for='(item, index) in dataList' :key='index'>
<div class='icon' :style='{ background: colors[index] }'></div>
<div class='item-content'>{{ item[showName] }}</div>
</div>
</div>
</template>
<script>
export default {
name: 'Legend',
data() {
return {
dataList: this.list
}
},
props: {
showName: {
type: String,
default: ''
},
list: {
type: Array,
default: () => []
},
colors: {
type: Array,
default: () => ['#FF6E76', '#7CFFB2', ' #FDF006', '#4FA0FF', '#EB6001', '#BF98FF', '#58D9F9','#C1EBDD', '#FFC851', '#5A5476']
}
},
watch: {
list(val) {
this.dataList = val
}
},
mounted() {
},
methods: {}
}
</script>
<style lang='scss' scoped>
.legend {
display: flex;
align-items: center;
flex-wrap: wrap;
width:14vw;
height: 8.54vh;
margin-left: 0.42vw;
.legend-item {
width: 6.5vw;
height: 2.44vh;
background: #0d133b;
align-items: center;
font-size: 8px;
color: #fff;
box-sizing: border-box;
margin: 2px 2px 2px 0;
white-space: nowrap;
.item-content {
width: 5.5vw;
overflow: hidden;
}
.icon {
width: 5px;
height: 5px;
background: #bf98ff;
border-radius: 50%;
margin: 4px;
}
}
}
</style>