蓝牙小优化,App隐藏时断开设备连接
This commit is contained in:
@ -509,6 +509,16 @@
|
||||
},
|
||||
onShow() {
|
||||
this.Status.pageHide = false;
|
||||
|
||||
let f = this.getDevice();
|
||||
if (f) {
|
||||
these.formData.bleStatu = 'connecting';
|
||||
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
|
||||
console.log("连接成功")
|
||||
these.formData.bleStatu = true;
|
||||
});
|
||||
}
|
||||
|
||||
this.getLinkedCnt();
|
||||
},
|
||||
computed: {
|
||||
@ -975,13 +985,13 @@
|
||||
|
||||
},
|
||||
deviceDispose(res) {
|
||||
if (this.Status.pageHide) {
|
||||
return;
|
||||
}
|
||||
// if (this.Status.pageHide) {
|
||||
// return;
|
||||
// }
|
||||
if (res.deviceId == these.formData.deviceId) {
|
||||
if(res.device){
|
||||
if (res.device) {
|
||||
these.formData.bleStatu = 'connecting';
|
||||
}else{
|
||||
} else {
|
||||
this.formData.bleStatu = false;
|
||||
}
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user