怎么获取默认tabbar的高度?

发布于 7 年前作者 yan781702 次浏览最后编辑 7 年前来自 ask

这个页面标题栏是自定义的,然后我想根据标题栏的高度和tabbar的高度得到中间内容scroll-view的高度,现在的问题是怎么获得tabbar的高度?(因为标题栏是自定义的,所以wx.getSystemInfoSync()获得的高度不是我想要的高度)

2 回复
yong02
yong021 楼5 年前

 wx.getSystemInfo({

      success: e => {

        this.globalData.sysinfo = e

        this.globalData.StatusBar = e.statusBarHeight;

        let capsule = wx.getMenuButtonBoundingClientRect();


        if (capsule{

          this.globalData.Custom = capsule;

          this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight ;

          //2为手机调整没有用

          this.globalData.conttop = capsule.bottom + (e.statusBarHeight - (capsule.bottom - capsule.top)) / 2         

        

        } else {

          this.globalData.CustomBar = e.statusBarHeight + 50;

          this.globalData.conttop =e.statusBarHeight +43;

        }

      }

    })

我们自己系统用到的几个,你测试一下那个是你需要的,

自己的调试可以另外加上去【自己的底部肯定知道】

动态获取 可以考虑使用 https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html 这个

ljiang
ljiang2 楼5 年前

100vh - 标题栏高度