微信小程序-tab切换

//wxml

可用码
已使用
 
VIP服务码
VMI9E3L3G9
复制使用
VIP服务码
VMI9E3L3G9
已失效
 
.swiper-tab{
width: 100%;
border-bottom: 1rpx solid #e6e6e6;
text-align: center;
line-height: 68rpx;
box-sizing: border-box;
display: flex;
justify-content: space-around;
}
.swiper-tab-list{
font-size: 30rpx;
width:100rpx;
color: #999999;
font-weight: bold;
 
}
.on{
color: #333333;
border-bottom: 4rpx solid #da7c0c;
}
.swiper-box{ display: block; width: 100%; overflow: hidden; margin-bottom: 100rpx;}
 
data: {
winWidth: 0,
winHeight: 0,
// tab切换
currentTab: 0,
},
// 滑动切换tab
bindChange: function (e) {
var that = this;
that.setData({ currentTab: e.detail.current });
},
/**
* 点击tab切换
*/
swichNav: function (e) {
var that = this;
if (this.data.currentTab === e.target.dataset.current) {
return false;
} else {
that.setData({
currentTab: e.target.dataset.current
})
}
},
onLoad: function (options) {
var that= this;
wx.getSystemInfo({
success: function (res) {
that.setData({
winWidth: res.windowWidth,
winHeight: res.windowHeight
});
}
})
},

转载于:https://www.cnblogs.com/weiwentaweb/p/8257411.html

你可能感兴趣的:(微信小程序-tab切换)