uni-app如果自定义tabbar实现底部样式有凸起效果,背景带圆角

想要实现的效果、

大部分可以参考这一篇文章

小程序弹出框是没办法遮挡住底部的tabbar的,解决的办法是使用自定义tabbar。。uni-app小程序如何自定义tabbar-CSDN博客

我们只要改下index.wxml和index. wxs的代码就行了

复制代码
<view class="tab-bar">
  <block wx:for="{{list}}" wx:key="index">
    <view class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab">
       <view class="special-image" wx:if="{{selected === index}}">
              <image class="special-image-pic" mode="aspectFit" src="{{item.selectedIconPath}}" mode="aspectFit"></image>
       </view>
       <image class="item-image" mode="aspectFit" src="{{item.iconPath}}" mode="aspectFit" wx:else></image>
      <view class="tab-text" style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</view>
    </view>
  </block>
</view>
复制代码
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 96rpx;
  background: white;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  border-radius:32rpx 32rpx 0 0;
  padding-top:22rpx;
}

.tab-bar-border {
  background-color: rgba(0, 0, 0, 0.33);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 2rpx;
  transform: scaleY(0.5);
}

.tab-bar-item {
  flex: 1;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  position:relative;
}

.tab-bar-item .item-image {
  width: 46rpx;
  height: 46rpx;
  position: absolute;
  top: 0;
}
.tab-bar-item .special-image {
  position: absolute;
  top: -50rpx;
  left: 35rpx;
  width: 150rpx;
  height: 150rpx;
  text-align: center;
  box-sizing: border-box;
}
.tab-bar-item .special-image .special-image-pic {
  width: 100%;
  height: 100%;
}

.tab-bar-item .tab-text {
  margin-top: 4rpx;
}

.tab-bar-item .special-text {
  margin-top: 44rpx
}

.tab-bar-item .tab-text {
  font-size: 28rpx;
  position:absolute;
  bottom:0;
}
相关推荐
卷Java1 小时前
违规通知功能修改说明
java·数据库·微信小程序·uni-app
卷Java15 小时前
用户权限控制功能实现说明
java·服务器·开发语言·数据库·servlet·微信小程序·uni-app
王佳斌1 天前
sass变量默认
uni-app
二饭1 天前
uniapp与webview通信
uni-app
2501_915909061 天前
iOS 抓包工具有哪些?实战对比、场景分工与开发者排查流程
android·开发语言·ios·小程序·uni-app·php·iphone
2501_915918412 天前
iOS 框架全解析,原生框架与跨平台框架对比、开发应用打包与 App Store 上架实战经验
android·ios·小程序·https·uni-app·iphone·webview
街尾杂货店&2 天前
cssword属性
uni-app
鱼樱前端2 天前
uni-app快速入门章法(二)
前端·uni-app
三天不学习3 天前
uniapp集成语音识别与图片识别集成方案【百度智能云】
百度·uni-app·语音识别
卷Java3 天前
饼状图修复总结
java·spring boot·uni-app·echarts