1
0
forked from dyf/APP

蓝牙小优化,App隐藏时断开设备连接

This commit is contained in:
liub
2026-03-16 15:20:18 +08:00
parent 7512b7211c
commit ede41f68fd
21 changed files with 417 additions and 227 deletions

View File

@ -414,6 +414,14 @@ import request, { baseURL } from '@/utils/request.js';
},
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;
});
}
},
computed: {
@ -613,9 +621,9 @@ import request, { baseURL } from '@/utils/request.js';
},
deviceDispose(res) {
if (this.Status.pageHide) {
return;
}
//if (this.Status.pageHide) {
// return;
//}
if (res.deviceId == these.formData.deviceId) {
if(res.device){
these.formData.bleStatu = 'connecting';