vg-print 1.1.406 → 1.1.407

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
@@ -1290,99 +1290,6 @@ await exportImage(tpl, printData, {
1290
1290
  - `maxCanvasPixels`:单页最大画布像素上限;导出卡顿/崩溃时可调小(例如 `2e7`)。
1291
1291
  - `debugPerf`:输出每页渲染耗时到控制台,便于定位慢点。
1292
1292
 
1293
- ### 导入说明(含描述)
1294
-
1295
- - 所有运行时 API 由库入口直接导出;无需另装 `vue-plugin-hiprint`
1296
- - 如需自定义元素提供器,在调用前执行 `hiprint.init({ providers: [...] })`;默认已初始化内置提供器
1297
-
1298
- ### 适用场景(含描述)
1299
-
1300
- - 后台页面、弹窗、任务流:仅需“模板 + 数据”的预览/打印/导出能力
1301
- - 脚本或批量任务:结合 `exportPdf`/`exportImage` 实现批量导出
1302
-
1303
- ## 注意事项
1304
-
1305
- - 建议在 `index.html` 注入 `print-lock.css`,保证打印样式稳定
1306
- - 直接打印需配套客户端(Electron 或服务端),跨域部署需启用 HTTPS
1307
- - 若使用自定义 `host/token`,确保客户端配置一致且网络可达
1308
- - SSR 兼容:插件安装仅在浏览器环境执行(`typeof window !== 'undefined'`),在 SSR 框架中引入不会因 `window` 未定义报错。
1309
-
1310
- ## 完整示例
1311
-
1312
- ```vue
1313
- <template>
1314
- <FullDesigner
1315
- :initial-template="tpl"
1316
- :initial-print-data="rows"
1317
- default-lang="cn"
1318
- :hi-host="host"
1319
- :hi-token="token"
1320
- :hi-auto-connect="true"
1321
- @save="onSave"
1322
- />
1323
-
1324
- <div style="margin-top: 12px;">
1325
- <el-input v-model="host" placeholder="客户端地址,如 http://127.0.0.1:17521" style="width: 360px; margin-right: 8px;" />
1326
- <el-input v-model="token" placeholder="鉴权令牌" style="width: 200px; margin-right: 8px;" />
1327
- <el-button type="primary" @click="applyHostToken">应用连接参数</el-button>
1328
- <el-button style="margin-left:8px;" @click="preview">预览</el-button>
1329
- <el-button style="margin-left:8px;" @click="printBrowser">浏览器打印</el-button>
1330
- </div>
1331
- </template>
1332
-
1333
- <script setup>
1334
- import { ref } from 'vue'
1335
-
1336
- // 模板(示例)
1337
- const tpl = {
1338
- panels: [
1339
- {
1340
- index: 0,
1341
- paperType: 'A4',
1342
- width: 210,
1343
- height: 297,
1344
- printElements: [
1345
- {
1346
- options: { left: 20, top: 20, title: '标题', field: 'title', fontSize: 18 },
1347
- printElementType: { type: 'text' }
1348
- },
1349
- {
1350
- options: { left: 20, top: 50, title: '姓名', field: 'name' },
1351
- printElementType: { type: 'text' }
1352
- }
1353
- ]
1354
- }
1355
- ]
1356
- }
1357
-
1358
- // 数据(对象或数组均可)
1359
- const rows = [{ title: '病理图文报告', name: '东东' }]
1360
-
1361
- // 连接参数
1362
- const host = ref('http://127.0.0.1:17521')
1363
- const token = ref('')
1364
-
1365
- // 组件引用
1366
- const designer = ref(null)
1367
-
1368
- const applyHostToken = () => {
1369
- // 设置客户端地址与令牌,并尝试重连
1370
- designer.value?.setHiwebSocket(host.value, token.value)
1371
- }
1372
-
1373
- // 预览与浏览器打印
1374
- const preview = () => designer.value?.preView()
1375
- const printBrowser = () => designer.value?.printView()
1376
-
1377
- // 保存事件:拿到模板与数据入库
1378
- const onSave = ({ template, data, templateId }) => {
1379
- // 持久化示例
1380
- // await api.save({ template, data, templateId })
1381
- console.log('save payload:', { template, data, templateId })
1382
- }
1383
- </script>
1384
- ```
1385
-
1386
1293
  ## License
1387
1294
 
1388
1295
  LGPL