关于tabBar的问题
发布于 6 年前 作者 yanglong 20183 次浏览 来自 问答

有没有办法让不是tabBar 中的页面也显示出tabBar呢?

4 回复

这是基本布局的问题呀,用position: fixed;可以达到效果吧,反正点击跳回真的tabBar就好

<view class=“bottom-bar box”>

  <view class=“bottom-bar-item” bindtap=“toTapbar” data-url=“index”>

    <view class=“item-img”>

      <image src="**"></image>

    </view>

    <view class=“item-text”>首页</view>

  </view>

  <view class=“bottom-bar-item” bindtap=“toTapbar” data-url=“public”>

    <view class=“item-img”>

      <image src="**"></image>

    </view>

    <view class=“item-text”>发布</view>

  </view>

  <view class=“bottom-bar-item” bindtap=“toTapbar” data-url=“myself”>

    <view class=“item-img”>

      <image src="**"></image>

    </view>

    <view class=“item-text”>我的</view>

  </view>

</view>

.bottom-bar{

  position: fixed;

  bottom: 0;

  left: 0;

  padding: 5rpx 0 0;

  background: #fff;

  border-top: 1rpx solid #7A7E83;

}

.bottom-bar-item{

  width: 250rpx;

  text-align: center;

}

.item-img{

  width: 100%;

}

.item-img image{

  width: 52rpx;

  height:52rpx;

  vertical-align: middle;

}

.item-text{

  font-size: 24rpx;

  color: #7A7E83;

}

/*弹性盒模型*/

.box {

    display: -webkit-box;

    display: -webkit-flex;

    display: -ms-flexbox;

    display: flex;

}

如果自己写的话      非tabbar页面的  tabbar的高度是怎么确定的

如果自己写要怎么保证view一直浮动在最底部呢?

这个是不行的,tabBar的页面一定要在app.json配置好。但是其他页面一定要,你可以自己写一个跟tabBar一样的样式啊

回到顶部