//获取#header的高度
var query = wx.createSelectorQuery();
//选择id
let that = this;
query.select('#header').boundingClientRect(function (rect) {
console.log("获取头部的高度成功");
that.setData({
headerHeight:rect.height
});
}).exec();
//获取“可使用窗口”的高度(注意:不包括底下tab栏的高度)
wx.getSystemInfo({
success: function (res) {
that.setData({
scrollview:res.windowHeight-that.data.headerHeight
})
}
})
wxml
<view style='height:{{scrollview}}px;'></view>
scroll-view滚动条隐藏
wxss
/* scroll-view滚动条隐藏 */
::-webkit-scrollbar{
width: 0;
height: 0;
color: transparent;
}