wx.getBatteryInfo({
success:function(res){
const level = res.level
console.log('getBatteryInfo:success', level)
global.logger.log('getBatteryInfo:success', level)
if(level >= 40){
that.showUpgradeFn()
}else{
that.showModalDia('电池电量提示',`电量低于40%时,不能升级固件当前电量${level}%`)
}
},
fail:function(err){
global.logger.log('getBatteryInfo:error', err)
that.showModalDia('失败','获取电池电量失败,请重试')
}
})
请问一下楼主解决这个问题了嘛,我也遇到了返回-1的情况