From 9e27d62e0ee2de4d11cd29bbce97d9580b588cf8 Mon Sep 17 00:00:00 2001 From: my_ong <429426262@qq.com> Date: Sat, 14 Dec 2024 11:29:19 +0800 Subject: [PATCH] =?UTF-8?q?bug:=20=E6=89=93=E5=8D=B0=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E6=88=91=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E8=AF=B7=E6=B1=82=E5=90=8E=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/stock/material/print-code.vue | 29 +++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/views/stock/material/print-code.vue b/src/views/stock/material/print-code.vue index 41ac7ce..dd026bf 100644 --- a/src/views/stock/material/print-code.vue +++ b/src/views/stock/material/print-code.vue @@ -52,20 +52,20 @@ honorMarginPadding: false, targetStyles: ['*'], style: ` - @page { - size: ${widthInches}in ${heightInches}in; - margin: 0; - } - body { - margin: 0; - padding: 0; - font-size: 6px; - } - #barcodes-container canvas { - display: block; - margin-bottom: 2mm; /* 调整条形码之间的间距 */ - } - `, + @page { + size: ${widthInches}in ${heightInches}in; + margin: 0; + } + body { + margin: 0; + padding: 0; + font-size: 6px; + } + #barcodes-container canvas { + display: block; + margin-bottom: 2mm; /* 调整条形码之间的间距 */ + } + `, onLoadingStart: () => console.log('开始加载'), onLoadingEnd: () => console.log('加载完成'), // onError: (err: Error) => console.error('打印出错:', err), @@ -80,6 +80,7 @@ // 定义一个函数来从后端获取条形码字符串并打印 const fetchAndPrintBarcodes = (count: number) => { + if (count <= 0) return // 清空之前的条形码容器 const container = document.getElementById('barcodes-container') if (!container) throw new Error('条形码容器未找到')