小程序
小游戏
企业微信
微信支付
扫描小程序码分享
wx.getSystemInfo和wx.createSelectorQuery()在有tabBar的情况下获取的可用高度都有误。
6 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
在onReady中获取,不要在onLoad中获取,可以在view中声明元素<view style='height:100%;width:100%;position:fixed;z-index:-100;' id='getHeight'></view>
onReady:function(){
var query = wx.createSelectorQuery();
query.select('#getHeight').boundingClientRect()
query.exec(function (resu) {
var res = wx.getSystemInfoSync();
var height = resu[0].height; //这个便是页面的可用高度
var _height = '';
var width = resu[0].width;
if (res.system.indexOf("iOS") > -1) {
_height = height - 120;
} else {
_height = height - 70;
}
self.setData({ "windowHight": _height + "px", height: _height })
})
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
一直都没有人管这个BUG啊?。。。。。。。。。。。。。。。
官方人员呢?BUG都不管了吗?
年前就提出了这个BUG,到现在一点回应都没有。
function
getSystemInfo(that, data) {
var
query = wx.createSelectorQuery()
query.select(
'.head'
).boundingClientRect()
query.exec(
(res) {
windowHeight = Math.round(res[0].height)
console.log(windowHeight);
let a = data_processing(data)
//为了上下都有能滑动,所以扔进去三个时间
display_data.push(mydate[0])
that.setData({
data: a,
display_data: display_data
console.log(
'display_data'
, display_data)
'mydate'
, mydate)
实际高度46.25,代码返回51.
麻烦官方人员出来改一下这个BUG好不好?已经提出来这么久了。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
在onReady中获取,不要在onLoad中获取,可以在view中声明元素<view style='height:100%;width:100%;position:fixed;z-index:-100;' id='getHeight'></view>
onReady:function(){
var query = wx.createSelectorQuery();
query.select('#getHeight').boundingClientRect()
query.exec(function (resu) {
var res = wx.getSystemInfoSync();
var height = resu[0].height; //这个便是页面的可用高度
var _height = '';
var width = resu[0].width;
if (res.system.indexOf("iOS") > -1) {
_height = height - 120;
} else {
_height = height - 70;
}
self.setData({ "windowHight": _height + "px", height: _height })
})
}
一直都没有人管这个BUG啊?。。。。。。。。。。。。。。。
官方人员呢?BUG都不管了吗?
年前就提出了这个BUG,到现在一点回应都没有。
function
getSystemInfo(that, data) {
var
query = wx.createSelectorQuery()
query.select(
'.head'
).boundingClientRect()
query.exec(
function
(res) {
windowHeight = Math.round(res[0].height)
console.log(windowHeight);
let a = data_processing(data)
//为了上下都有能滑动,所以扔进去三个时间
display_data.push(mydate[0])
display_data.push(mydate[0])
display_data.push(mydate[0])
that.setData({
data: a,
display_data: display_data
})
console.log(
'display_data'
, display_data)
console.log(
'mydate'
, mydate)
})
}
实际高度46.25,代码返回51.
麻烦官方人员出来改一下这个BUG好不好?已经提出来这么久了。