Commit c8069443 authored by wcmoon's avatar wcmoon

fix: 关闭发送请求

parent cd45c020
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
<template>
<img alt="Vue logo" src="./assets/logo.png">
{{progress}}
</template>
<script lang="ts">
import { Vue } from 'vue-class-component';
import {watch, reactive} from 'vue';
import print from "@/hooks/print";
import {imageBase64} from "../images";
export default {
setup() {
let images = reactive<string[]>(['1']);
let images = reactive<string[]>([imageBase64]);
let { progress} = print(images);
images.push('2');
images.push('2');
setTimeout(()=> {
images.push(imageBase64);
}, 3000)
console.log(progress);
return {
images
images,
progress
}
}
}
......
......@@ -53,11 +53,12 @@ export default function(images:any) {
*/
function goon() {
// 没有消息了就关闭 ws
if (sendList.length === sendedAmount.value) {
disconnectWebSocket();
if (sendList.length <= sendedAmount.value) {
disconnectWebSocket(;
} else {
// 从 sendListPrintData 中取出要打印的数据
const printData = (sendListPrintData[sendedAmount.value] as any).getPrintData();
console.log(sendListPrintData[sendedAmount.value])
const printData = sendListPrintData[sendedAmount.value];
let sendDataString = "{" +
"\"model\":\"" + 'L42 PRO' + "\"," +
"\"printerID\":\"ZPL\"," +
......@@ -67,6 +68,7 @@ export default function(images:any) {
"\"Items\":[" + printData + "]}]" +
"}";
const data = decodeURIComponent(sendDataString);
console.log(data);
ws.send(data)
sendedAmount.value += 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment