vg-print 1.1.304 → 1.1.305

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.en.md CHANGED
@@ -32,6 +32,20 @@ https://download.csdn.net/download/github_38400706/92538739
32
32
  ```bash
33
33
  npm i vg-print
34
34
  ```
35
+ If you need client direct printing (`hiwebSocket`), install the optional dependency in your host app:
36
+
37
+ ```bash
38
+ npm i socket.io-client
39
+ ```
40
+
41
+ In your main entry file (e.g., `main.ts`):
42
+
43
+ ```js
44
+ import { io } from 'socket.io-client'
45
+ import { setSocketIo } from 'vg-print'
46
+
47
+ setSocketIo(io)
48
+ ```
35
49
 
36
50
  ## Header Component
37
51
 
package/README.md CHANGED
@@ -106,6 +106,26 @@ hiprint.register({
106
106
  npm i vg-print
107
107
  ```
108
108
 
109
+ ### 可选依赖:直连打印/客户端连接(socket.io-client)
110
+
111
+ - 本库默认不内置 `socket.io-client`,以减少默认安装体积。
112
+ - 仅当你需要“直连打印/客户端连接(hiwebSocket)”能力(如 `print()` / `print2()` / 自动连接)时,才需要安装并注入:
113
+
114
+ ```bash
115
+ npm i socket.io-client
116
+ ```
117
+
118
+ 在项目入口(如 `main.ts`)注入:
119
+
120
+ ```js
121
+ import { io } from 'socket.io-client'
122
+ import { setSocketIo } from 'vg-print'
123
+
124
+ setSocketIo(io)
125
+ ```
126
+
127
+ 也可直接使用 `window.io = io`(等价)。
128
+
109
129
  ## Header 顶部工具栏组件
110
130
 
111
131
  - 用于页面一级头部区域,内置常用操作按钮与打印机设置;支持通过 `props` 与 `slots` 定制。
@@ -765,6 +785,8 @@ return (result.data || []).map(item => ({
765
785
 
766
786
  本库导出 `hiprint`,可直接创建与操作模板对象(`hiprint.PrintTemplate`):
767
787
 
788
+ 若需要使用“直连打印/客户端连接(hiwebSocket)”相关能力,请先按上文注入 `io`;否则会提示缺失并导致连接失败。
789
+
768
790
  ```js
769
791
  import { hiprint, defaultElementTypeProvider } from 'vg-print'
770
792
  // 全局配置