TopTab.vue
1.24 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
<template>
<div class="tab-box">
<div class="flex">
<div v-for="(item, index) in tabList" :key="index" class="tab-item" :class="tabActive == index ? 'tab-item-active' : ''" @click="changeTab(index)">{{ item }}</div>
</div>
<div>
<slot name="right"></slot>
</div>
</div>
</template>
<script>
export default {
name: 'TopTab',
props: {
tabList: {
type: Array,
default: () => []
}
},
data() {
return {
tabActive: 0
}
},
mounted() {},
methods: {
// tab切换
changeTab(index) {
this.tabActive = index
this.$emit('tabChange', index)
}
}
}
</script>
<style lang="scss" scoped>
.tab-box {
height: 4.44vh;
display: flex;
justify-content: space-between;
padding: 0.2vh 0.2vw;
box-sizing: border-box;
border: 2px solid;
border-image: linear-gradient(90deg, #074989, #30dcff, #074989) 1;
.tab-item {
height: 3.56vh;
line-height: 3.56vh;
font-weight: 400;
font-size: 14px;
color: #ffffffbf;
padding: 0 1.11vw;
cursor: pointer;
}
.tab-item-active {
font-weight: 500;
font-size: 14px;
color: #ffffff;
background-image: linear-gradient(270deg, #6578ff 0%, #079ff1 100%);
}
}
.flex {
display: flex;
}
</style>