diff --git a/index.html b/index.html
index 030a6ff51bfc6f6adcc472f6d8c02db92ce947a8..af691077f5790a358f9dda82a5a5687d32530add 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,9 @@
-
Vite App
+
+
+ 打印
diff --git a/package.json b/package.json
index 101d887fbb912d8980276a58b84eb565f9ac7eb6..16e3215f5dd1c9d3481a38acbc8823afc8fe3b8a 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,8 @@
"guess": "^1.0.2",
"vue": "^3.2.37",
"jsbarcode": "^3.11.6",
- "vue-html-to-paper":"^2.0.3"
+ "vue-html-to-paper":"^2.0.3",
+ "print-js":"^1.6.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.0.1",
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue
index eb0b61b184f8a0922e87fd017ca09f91fb1fdc5e..2975939e9034a300a0288970baaa659ae22cc493 100644
--- a/src/components/HelloWorld.vue
+++ b/src/components/HelloWorld.vue
@@ -1,64 +1,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 搜索
-
-
-
- 重置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 打印
-
-
-
-
+
+ 打印 html-to-paper
+
@@ -66,17 +11,17 @@
- {{
- state.formData.productListName }}
+
+ 标题
- 贮存条件:{{ state.formData.preserve }}
+ 贮存条件:冷藏
生产日期:2024-05-26
保质期至:2024-05-26
- 供应商:{{ state.formData.providerName }}
+ 供应商:华为
- {{ state.formData.printPrice }}元
- 净含量:{{ state.formData.netWeight }}g±{{ state.formData.weightRange }}g
+ 23元
+ 净含量:23g
@@ -86,14 +31,16 @@
- 打印
+ 打印html-to-paper
+ 打印 printjs
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
index a2506294bcc8223c4cf7f39c5cad5d6aa27fae4b..37c0642f2cbd426b099d5c139ed7630673d90652 100644
--- a/src/main.js
+++ b/src/main.js
@@ -5,4 +5,26 @@ import 'element-plus/dist/index.css'
import './assets/main.css'
-createApp(App).use(ElementPlus).mount('#app')
+import VueHtmlToPaper from 'vue-html-to-paper';
+
+const options = {
+ name: '_blank',
+ specs: [
+ 'fullscreen=yes',
+ 'titlebar=yes',
+ 'scrollbars=yes'
+ ],
+ styles: [
+ 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',
+ 'https://unpkg.com/kidlat-css/css/kidlat.css'
+ ],
+ timeout: 100000, // default timeout before the print window appears
+ autoClose: false, // if false, the window will not close after printing
+ windowTitle: '打印', // override the window title
+}
+
+
+createApp(App)
+.use(ElementPlus)
+.use(VueHtmlToPaper, options)
+.mount('#app')