当前位置:首页 > 千层云服务器 > 正文

小程序如何获取页面高度

小程序如何获取页面高度

小程序获取页面高度的代码示例:

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();

},


如果您对该产品感兴趣,请填写办理(客服微信:xiaoxiongyidong)

为您推荐:

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

在线客服