index.vue
1.98 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
<!-- 卡片切换组件 -->
<template>
<el-card
shadow="never"
class="tabchange-card"
>
<div class="tab-change">
<div
v-for="item in settingList"
:key="item.value"
class="tab-item"
:class="{ active: item.value == activeIndex }"
@click="tabChange(item.value)"
>
<span class="status">{{ item.label }}</span>
<span
v-if="isShowNum"
class="status-num"
style="font-weight: bold"
>{{
item.num
}}</span>
</div>
</div>
</el-card>
</template>
<script>
export default {
name: 'TabChange',
props: {
defaultActiveIndex: {
type: Number,
required: true
},
settingList: {
type: Array,
required: true
},
isShowNum: {
type: Boolean,
default: true
}
},
data() {
return {
activeIndex: this._props.defaultActiveIndex || 0
}
},
methods: {
tabChange(activeIndex) {
this.activeIndex = activeIndex
this.$emit('tabChange', activeIndex)
}
}
}
</script>
<style lang="scss">
.tabchange-card {
height: 48px;
margin-top: 20px;
.el-card__body {
padding: 0px;
}
.tab-change {
display: flex;
border-radius: 4px;
.tab-item {
width: 120px;
height: 48px;
text-align: center;
line-height: 48px;
color: #333;
font-size: 14px;
background-color: white;
cursor: pointer;
.special-item {
.el-badge__content {
width: 20px;
padding: 0 5px;
}
}
.item {
.el-badge__content {
background-color: #fd3333 !important;
line-height: 18px;
height: auto;
min-width: 18px;
min-height: 18px;
// border-radius: 50%;
}
.el-badge__content.is-fixed {
top: 14px;
right: 2px;
}
}
}
.active {
background-color: #ffeeeb;
color: #e15536;
}
}
}
</style>