uu
This commit is contained in:
parent
405015882a
commit
396e61fc0f
@ -34,15 +34,19 @@ export default {
|
||||
prtPercentage: 0, // 打印进度
|
||||
paperWidth: 480,
|
||||
imgRes: {},
|
||||
prtQueList: [],
|
||||
lastExeMark: undefined,
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.initData()
|
||||
},
|
||||
unmounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
async initData() {
|
||||
|
||||
},
|
||||
// 打印
|
||||
handlePrint(){
|
||||
@ -81,15 +85,32 @@ export default {
|
||||
}
|
||||
},
|
||||
// 给外部调用api,打印自定义图
|
||||
async callPrint({ paperWidth, imgRes } = {}) {
|
||||
this.paperWidth = paperWidth || this.paperWidth
|
||||
this.imgRes = imgRes
|
||||
async callPrint(obj) {
|
||||
this.prtQueList.push(obj)
|
||||
clearTimeout(this.lastExeMark)
|
||||
this.lastExeMark = setTimeout(()=> {
|
||||
this.finallyExecPrint()
|
||||
}, 500)
|
||||
},
|
||||
|
||||
async finallyExecPrint() {
|
||||
let conSta = await this.$refs.curBlueTooth.autoConnect()
|
||||
this.$emit('autoConnectCallback', conSta)
|
||||
if(conSta) {
|
||||
await this.handlePrint()
|
||||
return true
|
||||
|
||||
for(let i = 0; i < this.prtQueList.length; i ++) {
|
||||
let { paperWidth, imgRes } = this.prtQueList[i]
|
||||
if(imgRes) {
|
||||
this.paperWidth = paperWidth || this.paperWidth
|
||||
this.imgRes = imgRes
|
||||
if(conSta) {
|
||||
await this.handlePrint()
|
||||
this.prtQueList[i] = undefined // 打印成功 清除当前数据
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
this.prtQueList = []
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user