emis-app/pages/print/bluetoothPrinter.vue

52 lines
801 B
Vue
Raw Normal View History

2024-02-02 07:19:01 +00:00
<template>
2024-05-09 18:29:39 +00:00
<tpx-page>
2024-07-24 17:32:26 +00:00
<tpx-bluetooth-print ref="curPrint"></tpx-bluetooth-print>
2024-05-09 18:29:39 +00:00
</tpx-page>
</template>
2024-02-02 07:19:01 +00:00
<script>
2024-05-10 14:32:39 +00:00
2024-05-09 15:08:34 +00:00
export default {
2024-05-11 05:11:46 +00:00
2024-05-09 18:29:39 +00:00
computed: {
2024-05-10 14:32:39 +00:00
2024-05-09 18:29:39 +00:00
},
2024-05-09 15:08:34 +00:00
data () {
return {
2024-05-11 05:11:46 +00:00
pageLoading: true,
queryOption: {
imageUrl: '',
}
2024-05-09 15:08:34 +00:00
}
},
mounted () {
2024-07-24 17:32:26 +00:00
// 保证ref节点加载
this.initData();
2024-05-09 15:08:34 +00:00
},
2024-05-10 03:30:15 +00:00
unmounted() {
2024-05-10 14:32:39 +00:00
2024-05-11 05:11:46 +00:00
},
onLoad(option) {
this.queryOption = option
2024-05-10 03:30:15 +00:00
},
2024-05-09 15:08:34 +00:00
methods: {
2024-05-11 05:11:46 +00:00
initData(){
2024-07-24 17:32:26 +00:00
let urls = this.queryOption?.imageUrl?.split(",")
2024-08-08 17:05:36 +00:00
let prtCmdData = decodeURIComponent(this.queryOption?.prtCmdData || '')
2024-05-11 05:11:46 +00:00
this.pageLoading = false
2024-07-24 17:32:26 +00:00
if(urls?.length > 0) {
this.$refs.curPrint.startPrint({
imageUrl: urls,
2024-08-08 16:35:12 +00:00
prtCmdData
2024-07-24 17:32:26 +00:00
}, false)
} else {
this.showToast('缺少打印内容')
}
2024-05-11 05:11:46 +00:00
},
2024-02-02 07:19:01 +00:00
}
2024-05-09 15:08:34 +00:00
}
2024-02-02 07:19:01 +00:00
</script>
2024-05-10 03:15:31 +00:00
<style scoped lang="scss">
2024-05-10 14:32:39 +00:00
2024-05-09 15:08:34 +00:00
</style>