案例代码
onReady() {
// 获取系统配置参数
const resDIY = uni.getSystemInfoSync();
let info = uni.createSelectorQuery().in(this).select("#searchbox");
info.boundingClientRect((data) => {
this.height = (resDIY.windowHeight - data.height) + 'px'
}).exec(function(res) {
// 注意:exec方法必须执行,即便什么也不做,否则不会获取到任何数据
})
},
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11