onReady: function () {
let query = wx.createSelectorQuery();
let that = this;
query.select('#header').boundingClientRect(function (rect) {
that.setData({
height: rect.height + 'px',
width: rect.width + 'px'
})
}).exec();
}
微信小程序获取某个元素的宽度和高度
猜你喜欢
转载自blog.csdn.net/z591102/article/details/105117837
今日推荐
周排行