0 1 2 3 4 5 6 7 8 9 10 11 12 13 |
js页面 //创建节点选择器 var query = wx.createSelectorQuery(); //选择id var that = this; query.select('.every').boundingClientRect(function (rect) { // console.log(rect.width) that.setData({ height: rect.width + 'px' }) }).exec(); wxml页面 <view class='every' style='height:{{height}}'></view> |