前面把两个自定义花式的写了,哈哈,现在来写个简单的,注意哦:app.json里用了自带tabbar的那几个主页面不要引用,不然也要在app.js里去隐藏哦。
哦,对了,有个坏处就是,tabbar会闪,不过你们看着要求来呗。
这是微信自带的,记得也用上哦,后面需要显示出这个tabbar的话在引用模板
我的模板文件叫template
首先是template.wxml
<view class='footer'>
<view class='footer_list' data-id='{
{index}}' wx:for="{
{listInfo}}" data-current="{
{index}}" wx:key="this" bindtap="chooseImg">
<image class="footer-image" hidden='{
{curIdx===index}}' src="{
{item.imgUrl}}"></image>
<image class="footer-image" hidden='{
{curIdx!==index}}' src="{
{item.curUrl}}"></image>
<view class="footer-text">{
{item.text}}</view>
</view>
</view>
接着是template.wxss代码
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 95rpx; /*footer的高度*/
background: #fff;
z-index: 500;
border-top: 1rpx solid #e9e9e9;
display: flex;
flex-direction: row;
}
.footer_list {
width: 17%;
height: 100%