html部分
<div class="scrolls">
<span class="tags" :class="tabIndex00 == index ? 'active' : 'noactive'"
v-for="(e, index) in list" :key="index"
@click="changeTabIndex00(indexs)">{{ e.name}}</span>
</div>
js部分(data里面)
list:[
{name:'弃捐勿复道',label:0},
{name:'努力加餐饭',label:1}
],
tabIndex00: 0
changeTabIndex00(e) {
this.tabIndex00 = e
this.getList()
}
css部分
.scrolls {
display: flex;
white-space: nowrap;
overflow-x: scroll;
width: 100%;
.tags {
padding: 8px 32px;
background: #ffffff;
border-radius: 32px;
margin-left: 16px;
border: 1px solid #ddd;
color: #666;
}
.tags:first-child {
margin-left: 0;
}
}