taro-bluetooth-print 2.15.0 → 2.15.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/CHANGELOG.md +27 -0
- package/README.md +85 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.15.2] - 2026-07-07
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- ** Discussions 入口改造** — 因 GitHub Discussions 页面当前为空,正式文档中讨论入口改为 docs 内页面:`https://agions.github.io/taro-bluetooth-print/guide/discussions`
|
|
8
|
+
- README.md: `💬 讨论` 链接改为 docs 页面
|
|
9
|
+
- docs/roadmap.md: GitHub Discussions 链接改为 docs 页面
|
|
10
|
+
- 新增 docs/guide/discussions.md:整合社区渠道说明、Issue 报告规范、PR 规范、行为准则
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## [2.15.1] - 2026-07-07
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **README logo 修复** — npm 注册表 README 中 logo 使用相对路径 `docs/public/logo.svg`,在 npmjs.com 上无法访问。已改为绝对 URL:`https://agions.github.io/taro-bluetooth-print/logo.svg`(GitHub Pages 托管,全球 CDN 可用)
|
|
19
|
+
- **examples 文档补全** — 为 `examples/weapp` / `examples/h5` / `examples/harmonyos` / `examples/react-native` 各添加专业 README.md,包含前置条件、快速开始、核心代码说明、平台差异、常见问题
|
|
20
|
+
- **examples/README.md 重写** — 新增平台对比表、4 大示例场景(小票 / 标签 / 队列 / 断点续传)带完整代码示例、平台功能矩阵、常见问题汇总
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **README.md** — 示例项目章节从简单表格升级为带场景代码块的专业文档(+119 行)
|
|
25
|
+
- **examples/README.md** — 从 159 行重写为 187 行专业文档,新增 4 个平台 README(各 ~120-180 行)
|
|
26
|
+
- **Brand Consistency** — 所有示例文档统一使用品牌渐变色(indigo → cyan)和文档结构模板
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
3
30
|
## [2.15.0] - 2026-07-07
|
|
4
31
|
|
|
5
32
|
### Added
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
<img src="
|
|
3
|
+
<img src="https://agions.github.io/taro-bluetooth-print/logo.svg" alt="taro-bluetooth-print" width="120" />
|
|
4
4
|
|
|
5
5
|
# taro-bluetooth-print
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
[](https://github.com/agions/taro-bluetooth-print)
|
|
16
16
|
[](https://github.com/agions/taro-bluetooth-print/actions)
|
|
17
17
|
|
|
18
|
-
[🚀 快速开始](#-快速开始) · [📖 完整文档](https://agions.github.io/taro-bluetooth-print/) · [🧩 在线示例](https://github.com/Agions/taro-bluetooth-print/tree/main/examples) · [💬 讨论](https://github.
|
|
18
|
+
[🚀 快速开始](#-快速开始) · [📖 完整文档](https://agions.github.io/taro-bluetooth-print/) · [🧩 在线示例](https://github.com/Agions/taro-bluetooth-print/tree/main/examples) · [💬 讨论](https://agions.github.io/taro-bluetooth-print/guide/discussions)
|
|
19
19
|
|
|
20
20
|
</div>
|
|
21
21
|
|
|
@@ -261,12 +261,89 @@ printer.use(createRetryPlugin({ maxRetries: 3, backoffMultiplier: 2 }));
|
|
|
261
261
|
|
|
262
262
|
## 🧪 示例项目
|
|
263
263
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
|
267
|
-
|
|
268
|
-
|
|
|
269
|
-
|
|
|
264
|
+
完整的跨平台打印示例,覆盖微信小程序 / H5 / 鸿蒙 HarmonyOS / React Native 四大平台。
|
|
265
|
+
|
|
266
|
+
| 平台 | 适配器 | 示例文件 | 文档 |
|
|
267
|
+
|:---|:---|:---|:---|
|
|
268
|
+
| 微信小程序 | `TaroAdapter` | [`printer-page.tsx`](./examples/weapp/printer-page.tsx) | [README](./examples/weapp/README.md) |
|
|
269
|
+
| H5 | `WebBluetoothAdapter` | [`index.html`](./examples/h5/index.html) | [README](./examples/h5/README.md) |
|
|
270
|
+
| 鸿蒙 HarmonyOS | `HarmonyAdapter` | [`harmony-print-service.ts`](./examples/harmonyos/harmony-print-service.ts) | [README](./examples/harmonyos/README.md) |
|
|
271
|
+
| React Native | `ReactNativeAdapter` | [`PrinterScreen.tsx`](./examples/react-native/PrinterScreen.tsx) | [README](./examples/react-native/README.md) |
|
|
272
|
+
|
|
273
|
+
### 🎯 示例场景
|
|
274
|
+
|
|
275
|
+
#### 🧾 打印小票(ESC/POS)
|
|
276
|
+
|
|
277
|
+
适用于佳博 / 芯烨 / 商米 / 汉印 / 思普瑞特等热敏打印机。
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
await printer
|
|
281
|
+
.text('=== 欢迎光临 ===', { align: 'center', bold: true })
|
|
282
|
+
.feed()
|
|
283
|
+
.text('商品A x1 ¥10.00')
|
|
284
|
+
.text('商品B x2 ¥20.00')
|
|
285
|
+
.feed()
|
|
286
|
+
.text('------------------------')
|
|
287
|
+
.text('合计: ¥30.00', { bold: true })
|
|
288
|
+
.feed(2)
|
|
289
|
+
.qr('https://example.com', { size: 6 })
|
|
290
|
+
.feed(2)
|
|
291
|
+
.cut()
|
|
292
|
+
.print();
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**适用平台:** 全部 4 个平台
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
#### 🏷️ 打印标签(TSPL / ZPL / CPCL)
|
|
300
|
+
|
|
301
|
+
适用于 TSC / Zebra / HP / 霍尼韦尔等标签打印机。
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
const driver = new TsplDriver();
|
|
305
|
+
driver
|
|
306
|
+
.size(60, 40) // 60x40mm 标签
|
|
307
|
+
.gap(3) // 3mm 间隙
|
|
308
|
+
.clear()
|
|
309
|
+
.text('商品名称', { x: 20, y: 20, font: 3 })
|
|
310
|
+
.text('¥99.00', { x: 20, y: 60, font: 4 })
|
|
311
|
+
.barcode('6901234567890', { x: 20, y: 100, type: 'EAN13' })
|
|
312
|
+
.qrcode('https://example.com', { x: 250, y: 20 })
|
|
313
|
+
.print(1);
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**适用平台:** 全部 4 个平台(需打印机支持对应协议)
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
#### 📋 打印队列(批量任务)
|
|
321
|
+
|
|
322
|
+
适用于批量打印、订单打印等场景。
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
const queue = new PrintQueue({ maxSize: 100 });
|
|
326
|
+
queue.add(printData1, { priority: 'HIGH' });
|
|
327
|
+
queue.add(printData2, { priority: 'NORMAL' });
|
|
328
|
+
queue.on('job-completed', (job) => console.log('任务完成:', job.id));
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**适用平台:** 全部 4 个平台
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
#### 🔄 断点续传(大文件打印)
|
|
336
|
+
|
|
337
|
+
适用于打印大量内容(如 100 条订单)的场景。
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
const printPromise = printer.print();
|
|
341
|
+
setTimeout(() => printer.pause(), 5000);
|
|
342
|
+
setTimeout(async () => await printer.resume(), 10000);
|
|
343
|
+
await printPromise;
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**适用平台:** 全部 4 个平台
|
|
270
347
|
|
|
271
348
|
---
|
|
272
349
|
|