How to obtain the applet element pattern (a pitch width and height)

// Get the width and height set equal to the width

var query = wx.createSelectorQuery().in(this);

var that = this;

query.select('.chooseImgItem').boundingClientRect(function (rect) {

console.log(rect);

that.setData({

'objHeight': rect.width + 'px'

})

// console.log(that.data.objHeight);

}).exec();

Getting an element's style

If the acquisition is in the custom components inside, need

var query = wx.createSelectorQuery().in(this);

If it is, then get on the inside page

var query = wx.createSelectorQuery();

Published 20 original articles · won praise 0 · Views 132

Guess you like

Origin blog.csdn.net/qq_2422941992/article/details/104217459