在页面中调用wx.getSystemInfo即可获取当前页面的屏幕高度,如果写在app.js里面或者带有系统tab页面里面,获取的windowHeight会比不是tab的页面少48;
含有的TabBar的页面
var app = getApp();
data:{
windowHeight: app.globalData.windowHeight,
}
不含的TabBar的页面
var app = getApp();
data:{
windowHeight: app.globalData.windowHeight + 48
}
微信小程序获取windowHeight出现不同页面高度不一致问题及解决方案
原文:https://www.cnblogs.com/sillong/p/11636769.html