//获取滚动条可滚动⾼度 wx.getSystemInfo({ success: (res) => {
let screenHeight = wx.getSystemInfoSync().windowHeight //获取屏幕⾼度 // 通过query 获取其余盒⼦的⾼度
let query = wx.createSelectorQuery().in(this) query.select('.bgc').boundingClientRect() query.select('.bgcgray').boundingClientRect() query.select('.container').boundingClientRect()
query.select('.foot_submit_bar').boundingClientRect()
// 通过query.exec返回的数组 进⾏减法 同时 去除margin 和border的 query.exec(res => {
let bgcHeight = res[0].height let bgcgrayHeight = res[1].height let containerHeight = res[2].height let footHeight = res[3].height
screenHeight = screenHeight - bgcHeight - bgcgrayHeight - containerHeight - footHeight - console.log(screenHeight, 'screenHeight') this.setData({
clientHeight: screenHeight }); })
// this.setData({
// clientHeight: res.windowHeight - 108 // }); } });
// 因为scroll-view必须得给定⼀个⾼度 这个⾼度在不同⼿机下 需要进⾏动态计算 因为很多盒⼦是不设置⾼的
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- jqkq.cn 版权所有 赣ICP备2024042794号-4
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务