xlolic 10 місяці тому
джерело
коміт
eee229ad6b
1 змінених файлів з 5 додано та 2 видалено
  1. +5
    -2
      pages/bluetooth/connect.vue

+ 5
- 2
pages/bluetooth/connect.vue Переглянути файл

@@ -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);


Завантаження…
Відмінити
Зберегти