Vue.use(hiPrintPlugin,"$pluginName");// $pluginName 为自定义名称hiPrintPlugin.disAutoConnect();/// 提供的全局方法:/// provider 可为null args: 同模板对应调用 print 方法// 1. 打印this.$pluginName.print(provider, templateJson, ..
4)使用页面引入: <el-col :span="1.5"> <el-button type="info" plain icon="el-icon-printer" size="mini" @click="handlePrint" >打印</el-button> <template-print :row=" modalObj.form.row " ref="printRef"></template-print> </el-col> 引入: import templatePrint from '@/views/print/...
首先我们需要安装相关依赖 npm install vue-plugin-hiprint Or yarn add vue-plugin-hiprint 在使用前需要在项目入口文件index.html中加入(必须) <!--【必须】在index.html 文件中添加打印所需样式(此cdn可能不稳定):--> <!-- 可以调整成 相对链接/自有链接, 【重要】名称需要一致 【print-lock.css】-->...
源码链接:https://github.com/CcSimple/vue-plugin-hiprint-start 效果如下: 1.前言 首先我们应该清楚两种打印模式: 拖拽生成的html,创建iframe然后调用浏览器提供的printAPI 将生成的html,通过socket.io发送到直接打印客户端再调用electron提供的printAPI
printerList); } else { // 重新连接客户端 hiprint.hiwebSocket.setHost("http://localhost:17521") } }, 1000); } 扩展:可以通过本地存储记住上次选择的打印机 批量自动打印 js复制代码// 伪代码 const batchPrint = () => { selectRows.forEach((row: any) => { getOrderPrintData({ orderId:...
源码链接:https://github.com/CcSimple/vue-plugin-hiprint-start 效果如下: 1.前言 首先我们应该清楚两种打印模式: 拖拽生成的html,创建iframe然后调用浏览器提供的printAPI 将生成的html,通过socket.io发送到直接打印客户端再调用electron提供的printAPI
print2(printData, { printer: "", title: "hiprint测试打印", }); } }); /** * socket连接报错? * 由于npm包更新到socket.io 3.x版本,官网提供的客户端,npm包是无法连接的 * 请使用gitee提供的客户端, 同时gitee客户端可传更多的参数, 如是否打印颜色/打印份数/DPI等 * 详情electron见:https://...
name, title: "hiprint测试打印", }); hiprintTemplate.print2(printData, { client: printer.clientId, printer: printer.name, title: "hiprint测试打印", }); 如果你不提供 client 中转服务将抛出一个 error 插件生态项目名称项目地址下载地址描述 vue-plugin-hiprint github、gitee npm 打印设计器 electron-...
{ host: "https://printjs.cn:17521", // 打印客户端的地址 token: "vue-plugin-hiprint", // 与打印客户端相同的 token }); const hiprintTemplate = new hiprint.PrintTemplate(); hiprintTemplate.printByHtml2(this.$refs.printRef, { printer: 'printerName', // 打印机名称,不填则默认打印机 ...
The Best Vue Plugin To convert Html page, Components to pdf. Latest version: 1.0.6, last published: 6 years ago. Start using vue-easy-printer in your project by running `npm i vue-easy-printer`. There are 3 other projects in the npm registry using vue-ea