代码:
onBluetoothDeviceFound() {var that=thiswx.onBluetoothDeviceFound((res) => {wx.showModal({title: '名字',content: 'aa',showCancel: true})console.log(res)res.devices.forEach(device => {if (!device.name && !device.localName) {return}if (device.name == that.data.name) {that.data.deviceID = device.deviceIdreturn false}
})})wx.stopBluetoothDevicesDiscovery({success: () => {console.log("stop")that.createBLEConnection()}})},在真机调试时,使用wx.onBluetoothDeviceFound会弹出提示框,但是非真机调试时,不会弹出提示框,也就是说不调用wx.onBluetoothDeviceFound这个函数,这是为什么呢?
onBluetoothDeviceFound() {var that=thiswx.onBluetoothDeviceFound((res) => {wx.showModal({title: '名字',content: 'aa',showCancel: true})console.log(res)res.devices.forEach(device => {if (!device.name && !device.localName) {return}if (device.name == that.data.name) {that.data.deviceID = device.deviceIdreturn false}
})})wx.stopBluetoothDevicesDiscovery({success: () => {console.log("stop")that.createBLEConnection()}})},在真机调试时,使用wx.onBluetoothDeviceFound会弹出提示框,但是非真机调试时,不会弹出提示框,也就是说不调用wx.onBluetoothDeviceFound这个函数,这是为什么呢?