小程序之创建节点选择器获取宽高
1.获取方法
onLoad: function (e) { var that = this; wx.createSelectorQuery().select('#the-id').boundingClientRect(function (rect) { that.setData({ container_width: Number(rect.width) / 7 }); }).exec() },
2.打印结果
1.获取方法
onLoad: function (e) { var that = this; wx.createSelectorQuery().select('#the-id').boundingClientRect(function (rect) { that.setData({ container_width: Number(rect.width) / 7 }); }).exec() },
2.打印结果