在uniapp中,你可以使用uni.getSystemInfo或uni.getSystemInfoSync方法来获取屏幕宽度。 使用异步方法 uni.getSystemInfo javascript uni.getSystemInfo({ success: function (res) { console.log('屏幕宽度:', res.screenWidth); // 屏幕宽度,单位px } });