bug: 添加条形码打印功能的依赖
This commit is contained in:
parent
ac86a8896c
commit
1a91efd119
@ -16,6 +16,8 @@
|
|||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"print-js": "^1.0.6",
|
||||||
|
"jsbarcode": "^3.11.0",
|
||||||
"@ant-design/icons-vue": "^7.0.1",
|
"@ant-design/icons-vue": "^7.0.1",
|
||||||
"@codemirror/lang-java": "^6.0.1",
|
"@codemirror/lang-java": "^6.0.1",
|
||||||
"@codemirror/lang-javascript": "^6.2.2",
|
"@codemirror/lang-javascript": "^6.2.2",
|
||||||
|
9
src/components.d.ts
vendored
9
src/components.d.ts
vendored
@ -13,6 +13,8 @@ declare module 'vue' {
|
|||||||
ACard: typeof import('ant-design-vue/es')['Card']
|
ACard: typeof import('ant-design-vue/es')['Card']
|
||||||
ACol: typeof import('ant-design-vue/es')['Col']
|
ACol: typeof import('ant-design-vue/es')['Col']
|
||||||
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
|
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
|
||||||
|
ADatePicker: typeof import('ant-design-vue/es')['DatePicker']
|
||||||
|
ADivider: typeof import('ant-design-vue/es')['Divider']
|
||||||
ADrawer: typeof import('ant-design-vue/es')['Drawer']
|
ADrawer: typeof import('ant-design-vue/es')['Drawer']
|
||||||
ADropdown: typeof import('ant-design-vue/es')['Dropdown']
|
ADropdown: typeof import('ant-design-vue/es')['Dropdown']
|
||||||
AFlex: typeof import('ant-design-vue/es')['Flex']
|
AFlex: typeof import('ant-design-vue/es')['Flex']
|
||||||
@ -35,18 +37,25 @@ declare module 'vue' {
|
|||||||
AModal: typeof import('ant-design-vue/es')['Modal']
|
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||||
APageHeader: typeof import('ant-design-vue/es')['PageHeader']
|
APageHeader: typeof import('ant-design-vue/es')['PageHeader']
|
||||||
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
||||||
|
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
||||||
|
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
||||||
|
AResult: typeof import('ant-design-vue/es')['Result']
|
||||||
ARow: typeof import('ant-design-vue/es')['Row']
|
ARow: typeof import('ant-design-vue/es')['Row']
|
||||||
ASelect: typeof import('ant-design-vue/es')['Select']
|
ASelect: typeof import('ant-design-vue/es')['Select']
|
||||||
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
||||||
ASpace: typeof import('ant-design-vue/es')['Space']
|
ASpace: typeof import('ant-design-vue/es')['Space']
|
||||||
|
AStatistic: typeof import('ant-design-vue/es')['Statistic']
|
||||||
|
ASteps: typeof import('ant-design-vue/es')['Steps']
|
||||||
ASubMenu: typeof import('ant-design-vue/es')['SubMenu']
|
ASubMenu: typeof import('ant-design-vue/es')['SubMenu']
|
||||||
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
||||||
ATable: typeof import('ant-design-vue/es')['Table']
|
ATable: typeof import('ant-design-vue/es')['Table']
|
||||||
ATabPane: typeof import('ant-design-vue/es')['TabPane']
|
ATabPane: typeof import('ant-design-vue/es')['TabPane']
|
||||||
ATabs: typeof import('ant-design-vue/es')['Tabs']
|
ATabs: typeof import('ant-design-vue/es')['Tabs']
|
||||||
ATag: typeof import('ant-design-vue/es')['Tag']
|
ATag: typeof import('ant-design-vue/es')['Tag']
|
||||||
|
ATextarea: typeof import('ant-design-vue/es')['Textarea']
|
||||||
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
||||||
ATransfer: typeof import('ant-design-vue/es')['Transfer']
|
ATransfer: typeof import('ant-design-vue/es')['Transfer']
|
||||||
|
ATree: typeof import('ant-design-vue/es')['Tree']
|
||||||
ATypographyLink: typeof import('ant-design-vue/es')['TypographyLink']
|
ATypographyLink: typeof import('ant-design-vue/es')['TypographyLink']
|
||||||
ATypographyParagraph: typeof import('ant-design-vue/es')['TypographyParagraph']
|
ATypographyParagraph: typeof import('ant-design-vue/es')['TypographyParagraph']
|
||||||
ATypographyTitle: typeof import('ant-design-vue/es')['TypographyTitle']
|
ATypographyTitle: typeof import('ant-design-vue/es')['TypographyTitle']
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<a-flex gap="middle" horizontal>
|
<a-flex gap="middle" horizontal>
|
||||||
<span class="ant-form-text">请输入打印的条码数量:</span>
|
<span class="ant-form-text">请输入打印的条码数量:</span>
|
||||||
<a-form-item name="input-number" no-style>
|
<a-form-item name="input-number" no-style>
|
||||||
<a-input-number v-model:value="inputRef" :min="1" :max="10" @change="fetchAndPrintBarcodes(inputRef)" />
|
<a-input-number v-model:value="inputRef" :min="1" :max="30" @change="fetchAndPrintBarcodes(inputRef)" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<button @click="printCode">打印条形码</button>
|
<button @click="printCode">打印条形码</button>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const inputRef = ref(0)
|
const inputRef = ref(1)
|
||||||
|
|
||||||
const printCode = () => {
|
const printCode = () => {
|
||||||
const container = document.getElementById('barcodes-container')
|
const container = document.getElementById('barcodes-container')
|
||||||
@ -64,7 +64,7 @@
|
|||||||
`,
|
`,
|
||||||
onLoadingStart: () => console.log('开始加载'),
|
onLoadingStart: () => console.log('开始加载'),
|
||||||
onLoadingEnd: () => console.log('加载完成'),
|
onLoadingEnd: () => console.log('加载完成'),
|
||||||
onError: (err) => console.error('打印出错:', err),
|
// onError: (err: Error) => console.error('打印出错:', err),
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示条形码容器以便打印
|
// 显示条形码容器以便打印
|
||||||
@ -98,8 +98,8 @@
|
|||||||
width: 1, // 条形码线条宽度
|
width: 1, // 条形码线条宽度
|
||||||
height: 70, // 条形码高度
|
height: 70, // 条形码高度
|
||||||
displayValue: true, // 显示条形码下方的文本
|
displayValue: true, // 显示条形码下方的文本
|
||||||
// fontOptions: "italic", // 文本样式
|
fontOptions: 'bold', // 文本样式
|
||||||
fontSize: 10, // 文本大小
|
fontSize: 12, // 文本大小
|
||||||
textMargin: 5, // 文本与条形码之间的间距
|
textMargin: 5, // 文本与条形码之间的间距
|
||||||
margin: 10, // 条形码周围的空白边距
|
margin: 10, // 条形码周围的空白边距
|
||||||
})
|
})
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user