uni.getSystemInfo({ success: function(res) { // res - 各种参数 console.log(res.windowWidth); // 屏幕的宽度 let info = uni.createSelectorQuery().select(".search"); info.boundingClientRect(function(data) { //data - 各种参数 console.log(data.height,'dddd') // 获取元素高度 }).exec() }
});