小程序获取页面高度的代码示例:
onReady: function () {//动态获取高度
this.autoHeight();
},
//动态获取高度
autoHeight:function(){
var that = this;
var query = wx.createSelectorQuery();
query.select('.container').boundingClientRect(function(rect) {
console.log("----w" + rect.height)
that.setData({
windowHeight: rect.height ,//获取页面高度
})
}).exec();
},