echrts 在uniapp写小程序时挡住tabbar,不跟随滑动问题记录

总结:如果你也出现了echarts挡住tabbar问题,不妨试试 scroll-view 组件限制高度

背景:在uniapp编写小程序代码中引入了echarts,引入页面还是tabbar

bug:

  1. echats绘制的图表层级太高,挡住tabbar
  2. 绘制图表不跟随父级移动

解决图表层级太高网上主要有两种方法,1.自定义tabbar 用cover-view(本项目为低代码配置项目,代价太大)。2.将图表转换为图片显示(方法太过繁琐,但不失为一种好方法,但改动也比较多,太懒不想动同事太多代码)

解决:通过限制页面长度实现tabbar的正常显示

  • 通过简单的css并没有效果,并且还会造成第二个bug,绘制图表不跟随父级移动
html 复制代码
<style>
.man{
	overflow-y: auto;
	height: calc(100vh - 50px - constant(safe-area-inset-bottom));
	height: calc(100vh - 50px - env(safe-area-inset-bottom));
}
</style>
  • 通过uniapp自带的scroll-view 轮动组件达到了想要的效果
html 复制代码
<scroll-view scroll-y="true" style="height: calc(100vh - 50px - constant(safe-area-inset-bottom));height: calc(100vh - 50px - env(safe-area-inset-bottom));"></scroll-view>

此时实现了大部分需求,但是还是有个问题,在ios下滑动时,图表会产生上下浮动的动画效果,虽然最后会回到正确位置。

相关推荐
多客:duokelijie2 小时前
代练订单系统选型思路:跨品类游戏接入、订单分层管理、自动结算逻辑拆解!
数据库·mysql·微信小程序·前端框架·uni-app·php·持续部署
码间留白8 小时前
鸿蒙端对接 BLE 血压计:从一次握手到读数入库(二)设备篇
物联网·uni-app·鸿蒙·蓝牙ble·血压计
AI源码1 天前
在线考试小程序
小程序·notepad++
华玥作者1 天前
Vue 3 + TypeScript + uni-app 组件库推荐:hy-app(华玥组件库)
vue.js·typescript·uni-app
FinelyYang1 天前
uniapp使用kkfileview在线预览ppt,excel,word,pdf类型文件
pdf·uni-app·powerpoint
2501_916008891 天前
iPhone 设备信息查看,用 KeyMob 看型号、序列号、电池健康和 UDID
android·ios·小程序·https·uni-app·iphone·webview
ModyQyW2 天前
vite-plugin-uni-manifest 0.7:在 uni-app 读取之前生成
前端·uni-app
lyz2468592 天前
uniapp vue3 小程序开发注意事项
uni-app
云-缩影2 天前
做微信小程序,自建服务器还是用云托管:技术选型对比
服务器·微信小程序·小程序
雪芽蓝域zzs2 天前
WebStorm Uniapp Support + Uniapp Tool + Uniappx Language Service讲解
vue.js·uni-app·webstorm