直接看代码
globalData: {
udgeBigScreen: false,//判断屏幕
},
onLaunch: function(e) {
/**判断屏幕大小 */
var judgeBigScreen = () => {
let result = false;
const res = wx.getSystemInfoSync();
const rate = res.windowHeight / res.windowWidth;
let limit = res.windowHeight == res.screenHeight ? 1.8 : 1.65; // 临界判断值
if (rate > limit) result = true;
return result;
}
this.globalData.judgeBigScreen = judgeBigScreen();
}
onLoad(option) {
console.log('是否为长屏 iPhone X', getApp().globalData.judgeBigScreen)
}