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() },