index.js
onLoad() {
// 设置scroll-view的高度
let windowHeight = wx.getSystemInfoSync().windowHeight; // 屏幕的高度
let windowWidth = wx.getSystemInfoSync().windowWidth; // 屏幕的宽度
this.setData({
scroll_height: (windowHeight * 750) / windowWidth - 336(减去已知原生的高度),
});
},
index.wxml
<scroll-view
class="mt-16"
scroll-y
style="height:{{scroll_height}}rpx"
></scroll-view>