使用onReady事件动态获取小程序页面的高度实现代码如下:onReady: function () {//动态获取高度this.autoHeight();},//动态获取高度autoHeight:functi
使用onReady事件动态获取小程序页面的高度
实现代码如下:
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();
},
--结束END--
本文标题: 如何动态获取小程序页面的高度
本文链接: https://www.lsjlt.com/news/116547.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-15
2024-05-15
2024-05-15
2024-05-15
2024-05-15
2024-05-15
2024-05-15
2024-05-15
2024-05-15
2024-05-15
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0