微信小程序实现MUI顶部导航栏选项卡的方法

发布时间:2020-06-23 09:50:46 作者:清晨
来源:亿速云 阅读:299

这篇文章将为大家详细讲解有关微信小程序实现MUI顶部导航栏选项卡的方法,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

DEMO下载

效果图

微信小程序实现MUI顶部导航栏选项卡的方法

WXML

<import src="../../template/list.wxml"/>

<view class="tui-tabbar-content">
 <view class="tui-tabbar-group">
 <text data-id="0" bindtap="changeTabbar" class="tui-tabbar-cell {{index == 0 &#63; 'tui-active' : ''}}">已获得赏金</text>
 <text data-id="1" bindtap="changeTabbar" class="tui-tabbar-cell {{index == 1 &#63; 'tui-active' : ''}}">赏金在路上</text>
 <text data-id="2" bindtap="changeTabbar" class="tui-tabbar-cell {{index == 2 &#63; 'tui-active' : ''}}">邀请失败</text>
 </view>
</view>
<view class="tui-list-box {{index == 0 &#63; '' : 'tui-hide'}}">
 <template wx:for="{{['选项卡一子选项 - 1','选项卡一子选项 - 2','选项卡一子选项 - 3','选项卡一子选项 - 4','选项卡一子选项 - 5','选项卡一子选项 - 6','选项卡一子选项 - 7','选项卡一子选项 - 8']}}" is="listNoneOnly" data="{{item}}"></template>
</view>
<view class="tui-list-box {{index == 1 &#63; '' : 'tui-hide'}}">
 <template wx:for="{{['选项卡二子选项 - 1','选项卡二子选项 - 2','选项卡二子选项 - 3','选项卡二子选项 - 4','选项卡二子选项 - 5']}}" is="listNoneOnly" data="{{item}}"></template>
</view>
<view class="tui-list-box {{index == 2 &#63; '' : 'tui-hide'}}">
 <template wx:for="{{['选项卡三子选项 - 1','选项卡三子选项 - 2','选项卡三子选项 - 3']}}" is="listNoneOnly" data="{{item}}"></template>
</view>

WXSS

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})
 }
})

关于微信小程序实现MUI顶部导航栏选项卡的方法就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

推荐阅读:
  1. 微信小程序如何实现顶部导航栏滑动tab效果
  2. 微信小程序如何实现MUI导航栏透明渐变功能

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

微信小程序 顶部导航栏 信小

上一篇:什么是ORM

下一篇:linux系统中安装yum的方法步骤

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》