xlolic 10 months ago
parent
commit
eee229ad6b
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      pages/bluetooth/connect.vue

+ 5
- 2
pages/bluetooth/connect.vue View File

@@ -219,10 +219,11 @@
if (that.connectDev && v.deviceId == that.connectDev.deviceId) v.isConnect = '1';
if (v.name && v.deviceId) return v;
})
console.log(that.keyword,"搜索的设备");
uni.getBluetoothDevices({
success(res){
res.devices.filter(v => {
console.log(v.name,"查找到的设备");
if (!that.blist.find(v2 => v2.deviceId == v.deviceId)) {
if (v.name.toLowerCase() == that.keyword.toLowerCase()) that.blist.push(v);
}
@@ -241,9 +242,11 @@
if (that.connectDev && v.deviceId == that.connectDev.deviceId) v.isConnect = '1';
if (v.name && v.deviceId) return v;
})
console.log(that.keyword,"搜索的设备");

uni.onBluetoothDeviceFound((res) => {
res.devices.filter(v => {
console.log(v.name,"查找到的设备");
//判断blist中如果没有就添加
if (!that.blist.find(v2 => v2.deviceId == v.deviceId)) {
if (v.name.toLowerCase() == that.keyword.toLowerCase()) that.blist.push(v);


Loading…
Cancel
Save