WeChat applet implements the effect of navigation bar tabs

不言
Release: 2018-06-26 17:29:20
Original
2219 people have browsed it

This article mainly introduces the WeChat mini program to realize the navigation bar tab effect in detail. It has a certain reference value. Interested friends can refer to it.

The example in this article is shared with everyone on WeChat. The specific code of the applet to implement the top tab of MUI is for your reference. The specific content is as follows

DEMO download

Rendering

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

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;}
Copy after login

JS

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

Summary

The switching of WeChat applet uses the judgment of a certain value to switch between the list and the tab bar!

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

About the implementation of the top navigation bar in the WeChat mini program

The loading component of the WeChat mini program displays the loading Introduction to the usage of input animation

Implementation of input input and dynamic setting buttons in WeChat applet

The above is the detailed content of WeChat applet implements the effect of navigation bar tabs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!