diff --git a/components/tpx-bluetooth-print/render-template.vue b/components/tpx-bluetooth-print/render-template.vue index ffbf402..f7c3bc6 100644 --- a/components/tpx-bluetooth-print/render-template.vue +++ b/components/tpx-bluetooth-print/render-template.vue @@ -58,12 +58,14 @@ export default { // 打印 handlePrint(){ const that = this - let { deviceId, serviceId, characteristicId } = this.$refs.curBlueTooth.getInstance() + let data = this.$refs.curBlueTooth.getConData() + console.log("打印组件选中数据:data=====", data) + let { deviceId, serviceId, characteristicId } = data return new Promise((resolve, reject)=> { let { bl } = that.checkPrintParam() if(!bl) { return reject('打印参数校验不通过') - } + } const opt = { ...{ deviceId, serviceId, characteristicId }, onProgress: (percentage) => { @@ -142,9 +144,9 @@ export default { }, checkPrintParam() { let msg = '', bl = false - let { deviceId, serviceId, characteristicId } = this.$refs.curBlueTooth.getInstance() + let { deviceId, serviceId, characteristicId } = this.$refs.curBlueTooth.getConData() !this.imgData && (msg = '打印内容不能为空,请重试') - if(!msg && (deviceId || serviceId || characteristicId)) { + if(!msg && !(deviceId && serviceId && characteristicId)) { msg = '请选选择打印设备' } msg && (showToast(msg)) diff --git a/components/tpx-bluetooth/tpx-bluetooth.vue b/components/tpx-bluetooth/tpx-bluetooth.vue index 441b319..ba714dc 100644 --- a/components/tpx-bluetooth/tpx-bluetooth.vue +++ b/components/tpx-bluetooth/tpx-bluetooth.vue @@ -326,8 +326,8 @@ export default { } } }, - getInstance() { - return this + getConData() { + return { deviceId: this.deviceId, serviceId: this.serviceId, characteristicId: this.characteristicId } } } }