x-print-designer 0.0.5 → 0.0.6
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 +56 -1
- package/dist/{JsBarcode-DR3EuD60.js → JsBarcode-CUiJ4kMt.js} +1 -1
- package/dist/{browser-DXN-y76H.js → browser-DIU9kPWX.js} +1 -1
- package/dist/{dom-to-image-more.min-S-TpuEqL.js → dom-to-image-more.min-vPlSBgID.js} +1 -1
- package/dist/{index-CcUJ-UmV.js → index-DdtP0Fsw.js} +1 -1
- package/dist/{index.es-698hP6_U.js → index.es-CJ4AuCoP.js} +1 -1
- package/dist/{jspdf.es.min-CSbVoGg3.js → jspdf.es.min-Dv-nNebO.js} +1 -1
- package/dist/{jszip.min-BKMA8ptO.js → jszip.min-BYYbhBEw.js} +1 -1
- package/dist/print-designer.es.js +1 -1
- package/dist/print-designer.umd.js +33 -33
- package/dist/{web-component-ZD0SqIW-.js → web-component-Bgs-OHJ9.js} +179 -115
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- [自动保存配置](#自动保存配置)
|
|
16
16
|
- [模板数据结构(完整格式)](#模板数据结构完整格式)
|
|
17
17
|
- [元素数据绑定](#元素数据绑定)
|
|
18
|
-
- [
|
|
18
|
+
- [图片元素使用说明](#图片元素使用说明)
|
|
19
19
|
- [支持的元素类型](#支持的元素类型)
|
|
20
20
|
- [技术栈](#技术栈)
|
|
21
21
|
|
|
@@ -578,6 +578,61 @@ interface PrintElement {
|
|
|
578
578
|
|
|
579
579
|
---
|
|
580
580
|
|
|
581
|
+
## 图片元素使用说明
|
|
582
|
+
|
|
583
|
+
图片元素支持 **三种方式** 设置图片:
|
|
584
|
+
|
|
585
|
+
### 方式 1:直接输入图片 URL
|
|
586
|
+
|
|
587
|
+
在图片元素的属性面板中,直接在"图片地址"输入框填写图片 URL(支持 HTTP/HTTPS 链接)。
|
|
588
|
+
|
|
589
|
+
```
|
|
590
|
+
https://example.com/logo.png
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
### 方式 2:本地上传(自动转 Base64)
|
|
594
|
+
|
|
595
|
+
点击属性面板中的 **"上传图片"** 按钮,从本地选择一张图片文件:
|
|
596
|
+
|
|
597
|
+
- 自动将图片转换为 **Base64** 字符串并填入图片地址
|
|
598
|
+
- 限制最大 **2MB**,超出会提示错误
|
|
599
|
+
- 支持所有常见图片格式(PNG、JPG、GIF、WebP 等)
|
|
600
|
+
|
|
601
|
+
> 也可以**双击画布上的图片元素**来快速触发上传(编辑模式下)。
|
|
602
|
+
|
|
603
|
+
### 方式 3:绑定变量
|
|
604
|
+
|
|
605
|
+
将图片元素的 `variable` 属性绑定到一个变量名,图片地址从数据中动态读取。
|
|
606
|
+
|
|
607
|
+
| 绑定方式 | 示例 | 数据值要求 |
|
|
608
|
+
|---------|------|-----------|
|
|
609
|
+
| 静态变量 | `@logoUrl` | 字符串:`"https://..."` 或 Base64 |
|
|
610
|
+
| 数组元素 | `@flightRecords[0].image` | 该字段值需为 URL 或 Base64 |
|
|
611
|
+
|
|
612
|
+
**在 sampleData 中对应的数据:**
|
|
613
|
+
|
|
614
|
+
```json
|
|
615
|
+
{
|
|
616
|
+
"variables": {
|
|
617
|
+
"logoUrl": "https://example.com/logo.png",
|
|
618
|
+
"avatarBase64": "data:image/png;base64,iVBORw0KGgo...",
|
|
619
|
+
"flightRecords": [
|
|
620
|
+
{ "image": "https://picsum.photos/id/1/200/80" }
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
### 总结
|
|
627
|
+
|
|
628
|
+
| 方式 | 适用场景 | 存储内容 |
|
|
629
|
+
|------|---------|---------|
|
|
630
|
+
| URL 输入 | 固定图片、CDN 资源 | URL 字符串 |
|
|
631
|
+
| 本地上传 | 无公网链接的图片 | Base64 编码字符串 |
|
|
632
|
+
| 变量绑定 | 每条数据图片不同 | URL 或 Base64 |
|
|
633
|
+
|
|
634
|
+
---
|
|
635
|
+
|
|
581
636
|
## 支持的元素类型
|
|
582
637
|
|
|
583
638
|
| 类型 | 标识 | 说明 |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, computed, onUnmounted, watch, shallowRef, loader, onMounted, nextTick, ref } from "./web-component-
|
|
1
|
+
import { defineComponent, h, computed, onUnmounted, watch, shallowRef, loader, onMounted, nextTick, ref } from "./web-component-Bgs-OHJ9.js";
|
|
2
2
|
var __defProp$2 = Object.defineProperty;
|
|
3
3
|
var __defProps = Object.defineProperties;
|
|
4
4
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { commonjsGlobal, getDefaultExportFromCjs } from "./web-component-
|
|
1
|
+
import { commonjsGlobal, getDefaultExportFromCjs } from "./web-component-Bgs-OHJ9.js";
|
|
2
2
|
import { _typeof as _typeof$1 } from "./typeof-DxTVrAEz.js";
|
|
3
3
|
var es_promise = {};
|
|
4
4
|
var es_promise_constructor = {};
|
|
@@ -10832,7 +10832,7 @@ function le() {
|
|
|
10832
10832
|
var h2 = l2.getContext("2d");
|
|
10833
10833
|
h2.fillStyle = "#fff", h2.fillRect(0, 0, l2.width, l2.height);
|
|
10834
10834
|
var f2 = { ignoreMouse: true, ignoreAnimation: true, ignoreDimensions: true }, d2 = this;
|
|
10835
|
-
return (i.canvg ? Promise.resolve(i.canvg) : import("./index.es-
|
|
10835
|
+
return (i.canvg ? Promise.resolve(i.canvg) : import("./index.es-CJ4AuCoP.js")).catch(function(t3) {
|
|
10836
10836
|
return Promise.reject(new Error("Could not load canvg: " + t3));
|
|
10837
10837
|
}).then(function(t3) {
|
|
10838
10838
|
return t3.default ? t3.default : t3;
|