一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

微信小程序实现导航栏选项卡效果的教程

时间:2018-02-02 编辑:猪哥 来源:一聚教程网

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

DEMO下载

效果图

WXML




 
  已获得赏金
  赏金在路上
  邀请失败
 


 


 


 


WXSS

css;">page{background-color: #efeff4;}
.tui-tabbar-content{
 padding: 10px;
}
.tui-tabbar-group{
 border: 1px solid #4cd964;
 border-radius: 3px;
 overflow: hidden;
 width: 100%;
 display: table;
 table-layout: fixed;
 color: #4cd964;
}
.tui-tabbar-cell{
 display: table-cell;
 width: 100%;
 height: 80rpx;
 line-height: 80rpx;
 font-size: 35rpx;
 text-align: center;
}
.tui-tabbar-cell:not(:last-child){border-right: 1px solid #4cd964;}
.tui-tabbar-cell.tui-active{background-color: #4cd964;color: #fff;}

.tui-list-box{border-top:1px solid #c8c7cc;}

JS

Page({
 data: {
  index: 0
 },
 changeTabbar(e){
  this.setData({ index: e.currentTarget.dataset.id})
 }
})

总结

微信小程序的切换,采用的是对某一个值的判断,来对列表和tab bar进行切换!

热门栏目