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() }
});