首页 > 技术文章 > 动态设置WX滚动条的高度(非常重要)

bwdblogs 2019-07-12 11:32 原文

wxml:
<scroll-view class="scroll" scroll-y="true" style="height:{{clientHeight?clientHeight+'px':'auto'}}">
js:
onShow: function (options) {
 

wx.setNavigationBarTitle({
title: options.title
});

var that = this;//用在wx的API中要用that不能用this
wx.getSystemInfo({
success: function (res) {
var height = res.windowHeight-46;//1rpx=0.5px
console.log(height);
that.setData({
clientHeight: height
})


}
});

 
},

推荐阅读