<scroll-view scroll-y style="height:{{scrollHeight}}px">
// 计算滚动高度
var windowHeight = that.data.windowHeight;
var headerHeight ;
wx.createSelectorQuery().selectAll('.mine_header').boundingClientRect(function (rects) {
rects.forEach(function (rect) {
headerHeight= (rect.height)+25;
console.log(headerHeight)
})
that.setData({
scrollHeight: windowHeight - headerHeight,
})
console.log('本次高度' + that.data.scrollHeight)
}).exec()
获取屏幕高度 再减去除了srcoll区域之外的所有容器高度 得出最后的高度 在设置高度内滚动内容如图: