printbench 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -51,6 +51,7 @@ import type { PrintBenchExportedPayload } from 'printbench'
51
51
  import 'printbench/style.css'
52
52
 
53
53
  function onExported(payload: PrintBenchExportedPayload) {
54
+ // payload.action: 'download' | 'upload'
54
55
  // payload.blob / payload.fileName / payload.format / payload.unit
55
56
  }
56
57
  </script>
@@ -75,8 +76,8 @@ function onExported(payload: PrintBenchExportedPayload) {
75
76
  |------|------|------|------|
76
77
  | `height` | `string` | `'100%'` | 根容器高度 |
77
78
  | `modelUrl` | `string` | — | 挂载后按 URL 自动导入模型(需 CORS) |
78
- | `uploadUrl` | `string` | — | 「一键上传」的 POST 地址;未设则提示接口未配置 |
79
- | `customExport` | `boolean` | `false` | 为 `true` 时,下载 / 一键上传只生成文件并触发 `exported`,不本地下载、不 POST |
79
+ | `uploadUrl` | `string` | — | 「一键上传」的 POST 地址;未设则无法上传 |
80
+ | `customExport` | `boolean` | `false` | 为 `true` 时,下载 / 一键上传只生成文件并触发 `exported`(用 `action` 区分),不本地下载、不 POST |
80
81
 
81
82
  ### Events
82
83
 
@@ -84,7 +85,7 @@ function onExported(payload: PrintBenchExportedPayload) {
84
85
  |------|------|------|
85
86
  | `ready` | — | 几何内核就绪 |
86
87
  | `error` | `string` | 可展示错误 |
87
- | `exported` | `{ format, fileName, blob, unit, axis? }` | 导出完成(下载、上传或 `customExport` 均会触发) |
88
+ | `exported` | `{ action, format, fileName, blob, unit, axis? }` | 导出完成。`action` 为 `'download'`(下载)或 `'upload'`(一键上传) |
88
89
  | `report` | 审核报告对象 | 下载 JSON / HTML 审核报告时触发 |
89
90
 
90
91
  `exported` 的 `format` 为 `'stl' | '3mf'`;多零件 STL 时 `fileName` 为 zip,`blob` 为打包后的文件。
@@ -1,6 +1,9 @@
1
1
  import type { DefineComponent } from 'vue'
2
2
 
3
+ export type PrintBenchExportAction = 'download' | 'upload'
4
+
3
5
  export interface PrintBenchExportedPayload {
6
+ action: PrintBenchExportAction
4
7
  format: 'stl' | '3mf'
5
8
  fileName: string
6
9
  blob: Blob
@@ -26,4 +29,4 @@ export interface PrintBenchProps {
26
29
  declare const PrintBench: DefineComponent<PrintBenchProps>
27
30
  export { PrintBench }
28
31
  export default PrintBench
29
- export type { ReviewReport }
32
+ export type { PrintBenchExportAction, PrintBenchExportedPayload, ReviewReport }