微信小程序中如何获取image标签的宽和高?
let query = wx.createSelectorQuery();
let that = this;
query.select(’#图片id’).boundingClientRect(function (rect) {
that.setData({
height: rect.height + ‘px’, //图片高
width: rect.width + ‘px’ //图片宽
})
}).exec();
希望该回答有用