小程序怎样获得页面高度
小程序获得页面高度的代码示例:
onReady:function(){//动态获得高度
this.autoHeight();
},
//动态获得高度
autoHeight:function(){
varthat=this;
varquery=wx.createSelectorQuery();
query.select('.container').boundingClientRect(function(rect){
console.log("----w"+rect.height)
that.setData({
windowHeight:rect.height,//获得页面高度
})
}).exec();
},
本文来源:https://www.yuntue.com/post/71136.html | 云服务器网,转载请注明出处!

微信扫一扫打赏
支付宝扫一扫打赏