From 4e5eae40e0f103235fe841bc7e10995ee7fa7eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=99=AE=E5=BB=BA?= <450837357@qq.com> Date: Thu, 3 Apr 2025 10:57:44 +0800 Subject: [PATCH] first --- src/App.vue | 13 ++++++++----- src/views/hiprint/index.vue | 10 +++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/App.vue b/src/App.vue index f81774a..19e6cff 100644 --- a/src/App.vue +++ b/src/App.vue @@ -36,19 +36,22 @@ const livePrint = ref(null); function print(printData, title) { if (window.hiwebSocket.opened && window.hiwebSocket.printerList.length) { - let mylivePrint = null; + let mylivePrint = localStorage.getItem("live-print"); let printerList = window.hiwebSocket.printerList.map(item => { return { label: item.name, value: item.name }; }); + console.log("mylivePrint", mylivePrint) console.log("printerList", printerList) - if (printerList && printerList.length) { - mylivePrint = printerList.find(item => item.label.indexOf("ZDesigner ZD888-203dpi ZPL") > -1).value; - console.log("livePrint2==>",mylivePrint); + if(!mylivePrint){ + if (printerList && printerList.length) { + mylivePrint = printerList.find(item => item.label.indexOf("ZDesigner ZD888-203dpi ZPL") > -1).value; + console.log("livePrint2==>",mylivePrint); + } } - if(!livePrint){ + if(!mylivePrint){ mylivePrint = "ZDesigner ZD888-203dpi ZPL (副本 2)"; } diff --git a/src/views/hiprint/index.vue b/src/views/hiprint/index.vue index b969b21..34f1056 100644 --- a/src/views/hiprint/index.vue +++ b/src/views/hiprint/index.vue @@ -287,7 +287,15 @@ export default defineComponent({ this.getPrintList(); } } - } + }, + livePrint: { + handler(v){ + if(v){ + console.log(v) + localStorage.setItem("live-print", v) + } + } + } }, created() {