本文实例为大家分享了微信小程序实现选项卡效果展示的具体代码,供大家参考,具体内容如下

成都创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于做网站、成都做网站、婺源网络推广、小程序定制开发、婺源网络营销、婺源企业策划、婺源品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;成都创新互联公司为所有大学生创业者提供婺源建站搭建服务,24小时服务热线:18980820575,官方网址:www.cdcxhl.com
demo.wxss
.swiper-tab{
width: 100%;
border-bottom: 2rpx solid #777777;
text-align: center;
line-height: 80rpx;}
.swiper-tab-list{ font-size: 30rpx;
display: inline-block;
width: 33.33%;
color: #777777;
}
.on{ color: #da7c0c;
border-bottom: 5rpx solid #da7c0c;}
.swiper-box{ display: block; height: 100%; width: 100%; overflow: hidden; }
.swiper-box view{
text-align: center;
}
demo.wxml
哈哈 呵呵 嘿嘿 我是哈哈 我是呵呵 我是嘿嘿
demo.js
Page( {
data: {
/**
* 页面配置
*/
winWidth: 0,
winHeight: 0,
// tab切换
currentTab: 0,
},
onLoad: function() {
var that = this;
/**
* 获取系统信息
*/
wx.getSystemInfo( {
success: function( res ) {
that.setData( {
winWidth: res.windowWidth,
winHeight: res.windowHeight
});
}
});
},
/**
* 滑动切换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
})
}
}
}) 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持创新互联。