From 540ee738f170241dfde5c0af04c7c747fc883b61 Mon Sep 17 00:00:00 2001 From: aihe <961836564@qq.com> Date: Fri, 10 May 2024 11:30:15 +0800 Subject: [PATCH] uu --- pages/print/bluetoothPrinter.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pages/print/bluetoothPrinter.vue b/pages/print/bluetoothPrinter.vue index e75169b..39d1369 100644 --- a/pages/print/bluetoothPrinter.vue +++ b/pages/print/bluetoothPrinter.vue @@ -5,7 +5,7 @@ - 搜索周边设备 + 搜索周边设备 停止搜索 打印 @@ -118,6 +118,7 @@ export default { canvas_width: 240, canvas_height: 240, curTab: 0, + searchLoading: false, devices: [], deviceId: '', serverList: [], @@ -130,6 +131,9 @@ export default { // 初始化蓝牙模块 this.openBluetoothAdapter() }, + unmounted() { + this.stopDiscoveryPrinter() + }, methods: { changeTab(type) { this.curTab = type @@ -154,6 +158,7 @@ export default { discoveryPrinter () { var _this = this _this.devices = [] + _this.searchLoading = true _this.curTab = 0 uni.startBluetoothDevicesDiscovery({ complete (e) { @@ -174,6 +179,7 @@ export default { }, // 停止搜寻附近的蓝牙外围设备 async stopDiscoveryPrinter () { + this.searchLoading = false let res = await this.renderPic() uni.stopBluetoothDevicesDiscovery() },