This commit is contained in:
aihe 2024-08-19 13:53:31 +08:00
parent 0d1400ff47
commit 47e479ba34
3 changed files with 14 additions and 2 deletions

View File

@ -194,6 +194,9 @@ export default {
this.deviceName = item.name
//连接蓝牙
let bl = await this.connect(this.deviceId)
if(bl) {
this.$emit('onConnected')
}
},
async connect (deviceId) {
var _this = this

View File

@ -1,5 +1,5 @@
<template>
<tpx-bluetooth-native ref="curBlueTooth">
<tpx-bluetooth-native ref="curBlueTooth" @onConnected="handleConnected">
<template v-slot:content></template>
</tpx-bluetooth-native>
@ -130,6 +130,9 @@ export default {
hideLoading()
}
return cBl
},
handleConnected(){
this.$emit('onConnected')
}
}
}

View File

@ -34,7 +34,7 @@
title="打印设备"
>
<view style="height: calc(75vh);">
<render-template ref="curPrint" @autoConnectCallback="autoConnectCallback"></render-template>
<render-template ref="curPrint" @autoConnectCallback="autoConnectCallback" @onConnected="handleConnected"></render-template>
</view>
</tpx-dialog>
@ -128,6 +128,7 @@ export default {
})
},
async confirmPrint(){
// 触发打印
let res = await this.$refs.curPrint.callPrint({
imgsRes: this.allImgRes,
paperWidth: this.paperWidth,
@ -137,6 +138,11 @@ export default {
autoConnectCallback(bl){
// 如果打印设备连接失败 需要显示打印设备弹框
this.printModel.show = !bl
},
// 蓝牙手动连接成功后,触发打印
handleConnected() {
this.printModel.show = false
this.confirmPrint()
}
}
}