小程序导航栏切换效果
1.效果展示
2.wxml
3.wxss
.tab-item {
/* width: 16.6%; */
height: 70rpx;
margin-left: 35rpx;
text-align: center;
font-size: 15px;
color: #333333;
}
.on {
border-bottom: 5rpx solid #E9D8C4;
font-weight: 600;
}
.swiper-tab {
display: flex;
flex-direction: row;
line-height: 80rpx;
/* border-bottom: 2rpx solid #777; */
}
4.js
swichNav: function (e) {
console.log(e);
var that = this;
if (this.data.currentTab === e.target.dataset.current) {
return false;
} else {
that.setData({
currentTab: e.target.dataset.current,
})
}
},
swiperChange: function (e) {
console.log(e);
this.setData({
currentTab: e.detail.current,
})
},