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> <template>
<img alt="Vue logo" src="./assets/logo.png"> <img alt="Vue logo" src="./assets/logo.png">
{{progress}}
</template> </template>
<script lang="ts"> <script lang="ts">
import { Vue } from 'vue-class-component'; import { Vue } from 'vue-class-component';
import {watch, reactive} from 'vue'; import {watch, reactive} from 'vue';
import print from "@/hooks/print"; import print from "@/hooks/print";
import {imageBase64} from "../images";
export default { export default {
setup() { setup() {
let images = reactive<string[]>(['1']); let images = reactive<string[]>([imageBase64]);
let { progress} = print(images); let { progress} = print(images);
images.push('2'); setTimeout(()=> {
images.push('2'); images.push(imageBase64);
}, 3000)
console.log(progress); console.log(progress);
return { return {
images images,
progress
} }
} }
} }
......
...@@ -53,11 +53,12 @@ export default function(images:any) { ...@@ -53,11 +53,12 @@ export default function(images:any) {
*/ */
function goon() { function goon() {
// 没有消息了就关闭 ws // 没有消息了就关闭 ws
if (sendList.length === sendedAmount.value) { if (sendList.length <= sendedAmount.value) {
disconnectWebSocket(); disconnectWebSocket(;
} else { } else {
// 从 sendListPrintData 中取出要打印的数据 // 从 sendListPrintData 中取出要打印的数据
const printData = (sendListPrintData[sendedAmount.value] as any).getPrintData(); console.log(sendListPrintData[sendedAmount.value])
const printData = sendListPrintData[sendedAmount.value];
let sendDataString = "{" + let sendDataString = "{" +
"\"model\":\"" + 'L42 PRO' + "\"," + "\"model\":\"" + 'L42 PRO' + "\"," +
"\"printerID\":\"ZPL\"," + "\"printerID\":\"ZPL\"," +
...@@ -67,6 +68,7 @@ export default function(images:any) { ...@@ -67,6 +68,7 @@ export default function(images:any) {
"\"Items\":[" + printData + "]}]" + "\"Items\":[" + printData + "]}]" +
"}"; "}";
const data = decodeURIComponent(sendDataString); const data = decodeURIComponent(sendDataString);
console.log(data);
ws.send(data) ws.send(data)
sendedAmount.value += 1; 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