小程序
小游戏
企业微信
微信支付
扫描小程序码分享
这个页面标题栏是自定义的,然后我想根据标题栏的高度和tabbar的高度得到中间内容scroll-view的高度,现在的问题是怎么获得tabbar的高度?(因为标题栏是自定义的,所以wx.getSystemInfoSync()获得的高度不是我想要的高度)
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
100vh - 标题栏高度
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
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 这个
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
100vh - 标题栏高度
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 这个