1 vue
<view class="head-nav">
<view :class="navIndex==1?'active':''" @click="checkIndex(1)">完成</view>
<view :class="navIndex==2?'active':''" @click="checkIndex(2)">未完成</view>
</view>
2 css
.head-nav{
display: flex;
margin: 24rpx 0;
width: 100%;
view{
margin: 10rpx;
}
.active{
position: relative;
font-weight: bold;
}
.active::after{
content: "";
position: absolute;
left: 32rpx;
bottom: -16rpx;
width: 34rpx;
height: 8rpx;
background: #2468F1;
border-radius: 4rpx;
}
}