溫馨提示×

如何動態獲取小程序頁面的高度

九三
400
2020-12-11 15:00:08
欄目: 云計算

如何動態獲取小程序頁面的高度

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

},

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女