bug: 打印数量我为空的时候,不请求后台
This commit is contained in:
parent
526bfa65b5
commit
9e27d62e0e
@ -52,20 +52,20 @@
|
|||||||
honorMarginPadding: false,
|
honorMarginPadding: false,
|
||||||
targetStyles: ['*'],
|
targetStyles: ['*'],
|
||||||
style: `
|
style: `
|
||||||
@page {
|
@page {
|
||||||
size: ${widthInches}in ${heightInches}in;
|
size: ${widthInches}in ${heightInches}in;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: 6px;
|
font-size: 6px;
|
||||||
}
|
}
|
||||||
#barcodes-container canvas {
|
#barcodes-container canvas {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 2mm; /* 调整条形码之间的间距 */
|
margin-bottom: 2mm; /* 调整条形码之间的间距 */
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
onLoadingStart: () => console.log('开始加载'),
|
onLoadingStart: () => console.log('开始加载'),
|
||||||
onLoadingEnd: () => console.log('加载完成'),
|
onLoadingEnd: () => console.log('加载完成'),
|
||||||
// onError: (err: Error) => console.error('打印出错:', err),
|
// onError: (err: Error) => console.error('打印出错:', err),
|
||||||
@ -80,6 +80,7 @@
|
|||||||
|
|
||||||
// 定义一个函数来从后端获取条形码字符串并打印
|
// 定义一个函数来从后端获取条形码字符串并打印
|
||||||
const fetchAndPrintBarcodes = (count: number) => {
|
const fetchAndPrintBarcodes = (count: number) => {
|
||||||
|
if (count <= 0) return
|
||||||
// 清空之前的条形码容器
|
// 清空之前的条形码容器
|
||||||
const container = document.getElementById('barcodes-container')
|
const container = document.getElementById('barcodes-container')
|
||||||
if (!container) throw new Error('条形码容器未找到')
|
if (!container) throw new Error('条形码容器未找到')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user