12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
建站问答 时间:2024-12-01 19:18:19
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
使用onReady事件动态获取小程序页面的高度实现代码如下:onReady:function(){//动态获取高度this.autoHeight();},//动态获取高度autoHeight:function(){varthat=this;varquer
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
使用onReady事件动态获取小程序页面的高度
实现代码如下:
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();
},
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19