var that = this var query = wx.createSelectorQuery(); query.select('.tab-list').boundingClientRect(); query.exec(function (res) { that.setData({ tabHeight: res[0].height }) });
res里面的值: