<!-- index.wxml -->
<view class="container" style="min-height: {{minHeight}}rpx;">
·
·
·
</view>
<!-- index.js -->
data: {
minHeight:getApp().globalData.minHeight
},
<!-- app.js -->
App({
onLaunch: function () {
let that = this;
// 获取最小高度
that.getMinHeight();
},
// 获取最小高度
getMinHeight(){
let that = this;
wx.getSystemInfo({
success: function(res) {
let windowHeightRpx = (res.windowHeight * (750 / res.windowWidth)); //将高度乘以换算后的该设备的rpx与px的比例
that.globalData.minHeight = windowHeightRpx - 158;
}
})
},
globalData: {
hasLogin:false,
minHeight:0
}
})