在开发过程中 scroll的高度是很让人头疼的,即使我说的这个方法也不能全部概括,不过也可以将就了.
computeScrollViewHeight() {
let that = this
let query = wx.createSelectorQuery().in(this)
query.select('.date_tab_box').boundingClientRect()
query.select('.table-box').boundingClientRect()
query.exec(res => {
let oneH = res[0].height
let twoH = res[1].height
let windowHeight = wx.getSystemInfoSync().windowHeight
let _height = windowHeight - oneH - twoH -100
this.setData({ _height: _height })
})
},
这个最后减100 也是每个机型试验,能够兼容大多数手机的设置,该函数要写在ready里面,这样结构是已经渲染完成的,欢迎指正