uu
This commit is contained in:
parent
f2babe0dd9
commit
2e99e87872
@ -7,7 +7,7 @@
|
||||
<u-row custom-style="gap: 10rpx;">
|
||||
<u-button @click="discoveryPrinter">搜索周边设备</u-button>
|
||||
<u-button @click="stopDiscoveryPrinter">停止搜索</u-button>
|
||||
<u-button @click="writeBLECharacteristicValue" type="primary" disabled="!(deviceId && !serviceId && characteristicId)">打印</u-button>
|
||||
<u-button @click="writeBLECharacteristicValue" type="primary" :disabled="!(deviceId && serviceId && characteristicId)">打印</u-button>
|
||||
</u-row>
|
||||
</view>
|
||||
<view class="">
|
||||
@ -15,7 +15,7 @@
|
||||
<u-steps activeColor="#969799" :current="curTab" direction="column" dot="true">
|
||||
<u-steps-item v-for="(item, index) in conInfos" @click="changeTab(index)">
|
||||
<template v-slot:title>
|
||||
<view class="clr-sub pl-20">{{item.title}}</view>
|
||||
<view :class="`${index == curTab ? 'clr-prm' : 'clr-sub'} pl-20`">{{item.title}}</view>
|
||||
</template>
|
||||
<template v-slot:desc>
|
||||
<view class="mt-10 pl-20">{{item.desc}}</view>
|
||||
@ -119,11 +119,11 @@ export default {
|
||||
canvas_height: 240,
|
||||
curTab: 0,
|
||||
devices: [],
|
||||
deviceId: '',
|
||||
deviceId: 'dda',
|
||||
serverList: [],
|
||||
serviceId: '',
|
||||
serviceId: 'dda',
|
||||
characteristics: [],
|
||||
characteristicId: ''
|
||||
characteristicId: 'dd'
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@ -161,7 +161,11 @@ export default {
|
||||
// ArrayBuffer转16进度字符串示例
|
||||
uni.onBluetoothDeviceFound(devices => {
|
||||
console.log("========devices=====", devices)
|
||||
_this.devices.push(devices.devices[0])
|
||||
let curDvs = devices?.devices?.[0] || {}
|
||||
// 过滤重复的
|
||||
if(curDvs.deviceId && _this.devices.map(t=> t.deviceId).indexOf(curDvs.deviceId) == -1) {
|
||||
_this.devices.push(curDvs)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user