先判断用户手机型号
uni-app提供了异步(uni.getSystemInfo
)和同步(uni.getSystemInfoSync
)的2个API获取系统信息。
onLoad() {
var _this = this;
//检测手机型号
uni.getSystemInfo({
success: function(res) {
console.log(res)
var system = '';
if (res.platform == 'android') system = parseInt(res.system.substr(8));
if (res.platform == 'ios') system = parseInt(res.system.substr(4));
if (res.platform == 'android' && system < 6) {
console.log("手机版本暂时不支持")
return
}
if (res.platform == 'ios' && system < 11) {
console.log("手机版本暂时不支持")
return
}
_this.platform = res.platform;
//初始化 Wi-Fi 模块
_this.startWifi(_this);