小程序之创建节点选择器获取宽高

1.获取方法

onLoad: function (e) {

        var that = this; 

        wx.createSelectorQuery().select('#the-id').boundingClientRect(function (rect) {

            that.setData({

                container_ Number(rect.width) / 7

            });

        }).exec()

    },

2.打印结果

原文地址:https://www.cnblogs.com/wanan-01/p/9042465.html