template
<view class="subsection">
<view v-for="(item,index) in list" :key="index" @click="tabsChange(index)">
<view :class="{active: index == current}">
{{item.name}}
</view>
</view>
</view>
js
list: [{
name: '总金额'
}, {
name: '礼品'
}, {
name: '票数',
}],
current:0, // 0 总金额 1 礼品 2 票数
// tab栏 切换
function tabsChange(index){
console.log(index)
state.current = index;
}
style
.subsection{
height: 96rpx;
line-height: 96rpx;
background-color: #fff;
font-size: 32rpx;
font-weight: 400;
color: #777777;
line-height: 44rpx;
disflex:flex;
align-item:center;
justify-content: space-around;
.active{
color: #333;
font-weight: 500;
border-bottom: 4rpx solid #5377B5;
}
}