chenhaozhe
2025-09-22 c5ce0e20f31b18a7f783088006e49a9a0dee2aa1
components/labelPrinterComponent/labelPrinterComponent.vue
@@ -101,11 +101,30 @@
            }
            
            for(let binary of binarys){
               let sendSuccess = await this.$refs.bt2.sendMessage(binary);
               console.log("发送是否成功: ", sendSuccess)
               if(sendSuccess === false) {
                  return
               }
                    try{
                        let sendSuccess = await this.$refs.bt2.sendMessage(binary);
                        console.log("发送是否成功: ", sendSuccess)
                        if(sendSuccess === false) {
                           return
                        }else {
                            // 断开蓝牙连接
                            this.$refs.bt2.closeBluetooth()
                            return uni.showToast({
                                icon: 'none',
                                title: '打印成功'
                            })
                        }
                    }catch(e) {
                        uni.showToast({
                            icon: 'none',
                            title: e
                        })
                        // 断开蓝牙连接
                        this.$refs.bt2.closeBluetooth()
                        // 停止传输
                        return
                    }
            }
         },
         async execPrint() {