图为iPhone 12 机型 需要处理刘海和底部黑边的问题2021-12-28 周二
在小程序中判断机型、要在App.js文件中进行。
App({
onLaunch() {
// 获取设备信息
wx.getSystemInfo({
success: res => {
let model = res.model;
if (/iphone\sx/i.test(model) || (/iphone/i.test(model) && /unknown/.test(model)) || /iphone\s11/i.test(model) || /iphone\s12/i.test(model) || /iphone\s13/i.test(model)) {
console.log('res.model', res.model)
wx.setStorageSync('isPhoneModel', true)
} else {
wx.setStorageSync('isPhoneModel', false)
}
},
fail: err => {},
complete: res => {}
})
},
}
网友评论