vg-print 1.1.304 → 1.1.306

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
@@ -88,8 +88,6 @@ hiprint.register({
88
88
 
89
89
  ## 静默打印客户端工具安装包
90
90
 
91
- ![静默打印客户端工具](https://gitee.com/gao111/electron-vg-print/raw/master/electron-hiprint.png)
92
-
93
91
  [客户端工具下载](https://download.csdn.net/download/github_38400706/92538739)
94
92
 
95
93
  ## 特性
@@ -106,6 +104,46 @@ hiprint.register({
106
104
  npm i vg-print
107
105
  ```
108
106
 
107
+ ### 可选依赖:直连打印/客户端连接(socket.io-client)
108
+
109
+ - 本库默认不内置 `socket.io-client`,以减少默认安装体积。
110
+ - 仅当你需要“直连打印/客户端连接(hiwebSocket)”能力(如 `print()` / `print2()` / 自动连接)时,才需要安装并注入:
111
+
112
+ ```bash
113
+ npm i socket.io-client
114
+ ```
115
+
116
+ 在项目入口(如 `main.ts`)注入:
117
+
118
+ ```js
119
+ import { io } from 'socket.io-client'
120
+ import { setSocketIo } from 'vg-print'
121
+
122
+ setSocketIo(io)
123
+ ```
124
+
125
+ 也可直接使用 `window.io = io`(等价)。
126
+
127
+ ### 可选依赖:数据源(axios)
128
+
129
+ - 本库默认不内置 `axios`,以减少默认安装体积。
130
+ - 仅当你需要“数据源管理/接口取数/字段联动”能力时,才需要安装并注入:
131
+
132
+ ```bash
133
+ npm i axios
134
+ ```
135
+
136
+ 在项目入口(如 `main.ts`)注入:
137
+
138
+ ```js
139
+ import axios from 'axios'
140
+ import { setHttpClient } from 'vg-print'
141
+
142
+ setHttpClient(axios)
143
+ ```
144
+
145
+ 未安装/未注入时,“数据源”入口会自动禁用;即使误触发也不会导致项目报错。
146
+
109
147
  ## Header 顶部工具栏组件
110
148
 
111
149
  - 用于页面一级头部区域,内置常用操作按钮与打印机设置;支持通过 `props` 与 `slots` 定制。
@@ -765,6 +803,8 @@ return (result.data || []).map(item => ({
765
803
 
766
804
  本库导出 `hiprint`,可直接创建与操作模板对象(`hiprint.PrintTemplate`):
767
805
 
806
+ 若需要使用“直连打印/客户端连接(hiwebSocket)”相关能力,请先按上文注入 `io`;否则会提示缺失并导致连接失败。
807
+
768
808
  ```js
769
809
  import { hiprint, defaultElementTypeProvider } from 'vg-print'
770
810
  // 全局配置