当前位置: 首页 > article >正文

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

 


http://www.kler.cn/news/327390.html

相关文章:

  • 数据结构:链表算法题
  • 机器学习:opencv--摄像头OCR
  • stable diffusion Webui插件的三种安装方法
  • 数据包签名校验的Web安全测试实践
  • go 使用笔记
  • django drf to_representation
  • 报错TypeError: cannot unpack non-iterable float object
  • CDGA|数据治理:策略与价值的深度融合
  • 第18周 2-正则表达式
  • 数据库 - Redis数据库
  • 爬虫设计思考之一
  • World of Warcraft [CLASSIC][80][Grandel] /console cameraDistanceMaxZoomFactor 2
  • Spring Boot 点餐系统:高效餐饮服务
  • 43. 创建纹理贴图
  • 使用Qt实现实时数据动态绘制的折线图示例
  • 从入门到精通:单片机 100个关键技术关键词
  • (最新已验证)stm32 + 新版 onenet +dht11+esp8266/01s + mqtt物联网(含微信小程序)上报温湿度和控制单片机(保姆级教程)
  • 信号量SEM
  • 淘宝商品详情API接口多线程调用:解锁数据分析行业的效率新篇章
  • Linux防火墙配置绿色端口,解决无法访问java服务的问题
  • LINUX下的驱动开发三
  • window系统下nginx管理脚本
  • 【数据库】深入解析 MongoDB 数据库语法
  • 《OpenCV 计算机视觉》—— 视频背景建模
  • 【React】react hooks的使用规则
  • 基于深度学习的持续的知识积累与转移
  • golang学习笔记19-面向对象(一):面向对象的引入
  • 9.30学习
  • 南沙C++信奥赛陈老师解一本通题: 1963:【13NOIP普及组】小朋友的数字
  • Redis 性能优化的高频面试题及答案