uni.getSystemInfo({
success: function(res) { // res - 各種參數
console.log(res.windowWidth); // 屏幕的寬度
let info = uni.createSelectorQuery().select(".類名");
info.boundingClientRect(function(data) { //data - 各種參數
console.log(data.width) // 獲取元素寬度
}).exec()
}
});