uni-app 自定义tabbar高度后 获取tabbar高度问题

uni-app 自定义tabbar高度后 获取tabbar高度问题

8 回复

忘记说了,我是pages.json里定义的,不是手动改的css

更多关于uni-app 自定义tabbar高度后 获取tabbar高度问题的实战教程也可以访问 https://www.itying.com/category-93-b0.html


收到,将会排查

百度谷歌和社区查了好久,都没人反馈这个问题,麻烦你们赶快更新一下。

回复 1***@qq.com: 已优化,后续发版会在此处说明

回复 DCloud_UNI_LXH: 今天你们发了3.1.11版本,但这个问题好像还没解决啊,

回复 1***@qq.com: 3.1.14.20210430-alpha已修复此问题

回复 DCloud_UNI_LXH: 正式版3.3.13.20220314还有这个问题,是只能用3.1.14.20210430-alpha才行吗?

在uni-app中自定义tabBar后,可以通过uni.getSystemInfoSync()获取tabBar的高度。具体操作如下:

  1. pages.json中配置自定义tabBar,并设置高度:
"tabBar": {
  "custom": true,
  "height": "100px"
}
  1. 在页面中获取tabBar高度:
onLoad() {
  const systemInfo = uni.getSystemInfoSync()
  const tabBarHeight = systemInfo.screenHeight - systemInfo.windowHeight - systemInfo.statusBarHeight
  console.log('tabBar高度:', tabBarHeight)
}
回到顶部