1.获取高度
let res = wx.getSystemInfoSync() ///微信api方法
let titleH;
if (res && res['system']) {
// 判断是否是安卓操作系统 (标题栏苹果为44px,安卓为48px)
if (res['system'].indexOf('Android') > 0) {
titleH = 48
} else {
titleH = 44
}
var height = titleH + res['statusBarHeight'];
console.log(height, 'height');
this.setData({
height: height
})
}
2.页面中使用
style="position:fixed;top:{{height}}px"