<div class="discover-secondTab" >
<div v-for="(element,indexs) in 3" :key="indexs" class="stysecondTab">
<div :class="{activeTab:curSecond==indexs}" @click="tabSecond(element,indexs)">
{{element.name}}
</div>
</div>
</div>
css代码:
.discover-secondTab{
overflow-X: scroll;
white-space: nowrap;
}
.discover-secondTab::-webkit-scrollbar {
/*滚动条整体样式*/
width: 0;
/*高宽分别对应横竖滚动条的尺寸*/
height: 0;
}
.stysecondTab{
margin-top: 30px;
margin-left: 20px;
width: 80px;
height: 30px;
line-height: 30px;
background-color: #f7f8fa;
color: #323233;
text-align: center;
border-radius: 30px;
display: inline-block;
// width: auto;
}
.activeTab{
background-color: #fde6e9;
color: #D4342F;
border-radius: 30px;
}
js代码:
data(){
return{
curSecond:0,
}
},
methods: {
// 二级标签点击
tabSecond(item,index){
this.curSecond = index
},
}