const query = wx.createSelectorQuery() query.select('#box-body').boundingClientRect() query.selectViewport().scrollOffset(); query.exec(function (res) { console.log(res); });
它会打印如下结果