Vue.use(hiPrintPlugin,"$pluginName");// $pluginName 为自定义名称hiPrintPlugin.disAutoConnect();/// 提供的全局方法:/// provider 可为null args: 同模板对应调用 print 方法// 1. 打印this.$pluginName.print(provider, templateJson, ...args);// 2. 直接打印this.$pluginName.print2(provider, te...
"$pluginName");// $pluginName 为自定义名称hiPrintPlugin.disAutoConnect();/// 提供的全局方法:/// provider 可为null args: 同模板对应调用 print 方法// 1. 打印this.$pluginName.print(provider,templateJson,...args);// 2. 直接打印this.$pluginName.print2(provider,templateJson,...args);...
在Vue2项目中使用vue-plugin-hiprint插件,可以按照以下步骤进行配置和使用: 1. 安装vue-plugin-hiprint插件 首先,你需要在你的Vue2项目中安装vue-plugin-hiprint插件。可以通过npm或yarn进行安装: bash npm install vue-plugin-hiprint 2. 在Vue2项目中引入vue-plugin-hiprint 在你的Vue项目的入口文件(通常是main...
在使用无预览打印时如果我们需要对打印内容设置样式,那我们需要把样式写成行内样式不然不会生效. // 全局引入 // main.js import { hiPrintPlugin } from 'vue-plugin-hiprint' Vue.use(hiPrintPlugin, '$pluginName') // 局部引入 import { hiPrintPlugin } from 'vue-plugin-hiprint' // template <template...
直接打印需要安装桌面插件,window.hiwebSocket.opened是为了判断socketIo是否打开,hiprintTemplate中的print2是直接打印,print是会显示预览的打印。直接打印在printIo底层会自动去连接客户端,以及传输数据。print() { if (window.hiwebSocket.opened) { const printerList = hiprintTemplate.getPrinterList(); console.log...
import { provider2 } from "./provider2"; // 自定义传入 provider 的参数 let options = { config: { tid: "providerModule1.header", title: "参数provider示例", type: "text", options: { testData: "单据表头", height: 30, fontSize: 16, ...
实现无预览打印的Vue2项目中,产品需求不支持浏览器直接调用打印机以避免安全风险。在gitee.com/CcSimple/vue-plugin-hiprint和gitee.com/CcSimple/electron-hiprint/releases地址中,提供了解决方案。首先,在项目入口文件index.html中,安装依赖。项目中实现无预览打印需确保打印内容样式设置为行内样式,以...
vue-plugin-hiprint(基于hiprint 2.5.4) 当时只是为了方便我(并非hiprint原作者)在vue项目中引入使用,所以以此命名。 此插件仅仅是一个JavaScript【工具库】而非 Vue【组件库】,所以它默认是不包含demo中所见的那些组件页面的(demo代码随便复制修改拿去用)。
直接打印需要安装桌面插件,window.hiwebSocket.opened是为了判断socketIo是否打开,hiprintTemplate中的print2是直接打印,print是会显示预览的打印。直接打印在printIo底层会自动去连接客户端,以及传输数据。 print() {if(window.hiwebSocket.opened) {constprinterList = hiprintTemplate.getPrinterList();console.log(printer...
1、安装插件: npm install vue-plugin-hiprint 或 yarn add vue-plugin-hiprint 2、普通使用: <template> <div class="box"> <div class="bo