bug: 添加条形码打印功能的依赖
Some checks failed
Release / lint (push) Failing after 6s
Release / Release (push) Has been skipped

This commit is contained in:
my_ong
2024-12-13 20:47:09 +08:00
parent ac86a8896c
commit 1a91efd119
4 changed files with 17 additions and 6 deletions

View File

@@ -16,6 +16,8 @@
"prepare": "husky"
},
"dependencies": {
"print-js": "^1.0.6",
"jsbarcode": "^3.11.0",
"@ant-design/icons-vue": "^7.0.1",
"@codemirror/lang-java": "^6.0.1",
"@codemirror/lang-javascript": "^6.2.2",

9
src/components.d.ts vendored
View File

@@ -13,6 +13,8 @@ declare module 'vue' {
ACard: typeof import('ant-design-vue/es')['Card']
ACol: typeof import('ant-design-vue/es')['Col']
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']
ADropdown: typeof import('ant-design-vue/es')['Dropdown']
AFlex: typeof import('ant-design-vue/es')['Flex']
@@ -35,18 +37,25 @@ declare module 'vue' {
AModal: typeof import('ant-design-vue/es')['Modal']
APageHeader: typeof import('ant-design-vue/es')['PageHeader']
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']
ASelect: typeof import('ant-design-vue/es')['Select']
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
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']
ASwitch: typeof import('ant-design-vue/es')['Switch']
ATable: typeof import('ant-design-vue/es')['Table']
ATabPane: typeof import('ant-design-vue/es')['TabPane']
ATabs: typeof import('ant-design-vue/es')['Tabs']
ATag: typeof import('ant-design-vue/es')['Tag']
ATextarea: typeof import('ant-design-vue/es')['Textarea']
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
ATransfer: typeof import('ant-design-vue/es')['Transfer']
ATree: typeof import('ant-design-vue/es')['Tree']
ATypographyLink: typeof import('ant-design-vue/es')['TypographyLink']
ATypographyParagraph: typeof import('ant-design-vue/es')['TypographyParagraph']
ATypographyTitle: typeof import('ant-design-vue/es')['TypographyTitle']

View File

@@ -3,7 +3,7 @@
<a-flex gap="middle" horizontal>
<span class="ant-form-text">请输入打印的条码数量:</span>
<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>
<button @click="printCode">打印条形码</button>
@@ -28,7 +28,7 @@
},
})
const inputRef = ref(0)
const inputRef = ref(1)
const printCode = () => {
const container = document.getElementById('barcodes-container')
@@ -64,7 +64,7 @@
`,
onLoadingStart: () => console.log('开始加载'),
onLoadingEnd: () => console.log('加载完成'),
onError: (err) => console.error('打印出错:', err),
// onError: (err: Error) => console.error('打印出错:', err),
}
// 显示条形码容器以便打印
@@ -98,8 +98,8 @@
width: 1, // 条形码线条宽度
height: 70, // 条形码高度
displayValue: true, // 显示条形码下方的文本
// fontOptions: "italic", // 文本样式
fontSize: 10, // 文本大小
fontOptions: 'bold', // 文本样式
fontSize: 12, // 文本大小
textMargin: 5, // 文本与条形码之间的间距
margin: 10, // 条形码周围的空白边距
})

File diff suppressed because one or more lines are too long