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
| <template>
| <div >
| <button
| class="filter-btn"
| v-for="(item,index) in array"
| v-bind:class="{'active':index === num}"
| :key="item.id"
| @click="activeClick(item.id,index)">{{item.value}}</button>
| </div>
| </template>
|
| <script>
| export default {
| name: "classification",
| props: {
| array: {
| type: Array,
| default: () => [],
| required: true
| },
| },
| data(){
| return {
| num:'',
| isActive:false
| }
| },
| methods:{
| activeClick(id,index){
| this.num = index
| this.$emit("setId",id)
| }
| }
|
| }
|
| </script>
|
| <style scoped>
| .filter-btn{
| cursor: pointer;
| min-width: 112px;
| height: 32px;
| border-radius: 15px;
| border: 1px solid #e5e5e5;
| background-color: #fff;
| color: #000;
| font-size: 14px;
| margin-right: 20px;
| margin-bottom: 10px;
| }
|
| .filter-btn:hover{
| border-color: #fff;
| background-color: #b2d8ff;
| color: #fff;
| }
|
| .active{
| background-color: #5dadff;
| border-color: #5dadff;
| color: #fff;
| }
|
| </style>
|
|