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
<template>
<view class="content">
<view class="items" v-for="(item,index) in tabList" :key="item.name" @click="tabsClick(index)">
<view class="flex-col">
<span :class="currentIndex == index ? 'active' : 'default'">{{item.name}}</span>
<span class="line-through" v-show="currentIndex == index"></span>
</view>
</view>
</view>
</template>
<script>
export default {
name: "tabs",
props:[],
data() {
return {
currentIndex:0,
tabList: [{
name: '聊天室',
}, {
name: '课件',
}, {
name: '直播详情'
}]
};
},
methods:{
tabsClick(index){
this.currentIndex = index
}
}
}
</script>
<style lang="scss" scoped>
.content {
display: flex;
height: 80rpx;
font-size: 32rpx;
box-shadow: 0 2rpx 10rpx #dadada;;
.items {
flex: 1;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
.line-through{
width: 40rpx;
height: 6rpx;
background-color: #1374E7;
margin-top: 6rpx;
}
}
}
.flex-col{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.active{
color:#1374E7
}
.default{
color:#999999
}
</style>