Skip to content

Commit 40aacda

Browse files
committed
update: 在调用 stopBeaconDiscovery 前判断启用状态,解决在 微信小程序真机测试告警
1 parent 132eb2d commit 40aacda

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

‎pages/API/ibeacon/ibeacon.vue‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
closeBluetoothAdapter(OBJECT) {
6666
this.stopBeaconDiscovery();
67-
uni.closeBluetoothAdapter({
67+
wx.closeBluetoothAdapter({
6868
success: (res) => {
6969
this.isOpen = false;
7070
console.log('断开蓝牙模块成功');
@@ -100,14 +100,16 @@
100100
});
101101
},
102102
stopBeaconDiscovery(types) {
103-
uni.stopBeaconDiscovery({
104-
success: (res) => {
105-
this.isStarted = false;
106-
},
107-
fail: (err) => {
108-
console.error(err);
109-
}
110-
});
103+
if(this.isStarted) {
104+
uni.stopBeaconDiscovery({
105+
success: (res) => {
106+
this.isStarted = false;
107+
},
108+
fail: (err) => {
109+
console.error(err);
110+
}
111+
});
112+
}
111113
},
112114
getBeacons() {
113115
uni.getBeacons({

0 commit comments

Comments
 (0)