杰表技术论坛 's Archiver

admin 发表于 2019-7-19 16:41

如何在vue框架中,使用杰表云打印(试用版已更新)

在一般的环境中,使用jcp,只需要引入安装包中提供的  jcp.js就行了,但在vue环境中,这个jcp.js不能直接拿来用,而需要稍加改动后,再引入。具体方法如下:
1. 下载 JCP for vue 软件包, [url=http://print.jatools.com/download/jcp4vue.zip]http://print.jatools.com/download/jcp4vue.zip[/url];
2.  软件包中的 jcp-vue.js 复制到你的vue项目中;
3. 在需要打印的页面中,这样来使用:[code]import {getJCP} from '../common/jcp-vue'
new Vue({
                        el : '#app',
                        methods : {
                                doPrint : function(how) {
                                        var myDoc = {
                                                documents : document, // 打印页面(div)们在本文档中
                                                copyrights : '杰创软件拥有版权  www.jatools.com' // 版权声明必须
                                        };
                                        var jcp = getJCP();
                                        // 调用打印方法
                                        if (how == '打印预览')
                                                jcp.printPreview(myDoc, false);
                                        else if (how == "打印预览(显示进度条)") {
                                                jcp.printPreview(myDoc, true);
                                        } else if (how == '弹出打印机选择对话框打印') {
                                                jcp.print(myDoc, true);
                                        } else
                                                jcp.print(myDoc, false); // 不弹出对话框打印
                                }
                        }
                })        [/code]4.  将软件包中的 setup.exe 安装到客户端,注意,此JCP 为 VUE演示专用,不能用来浏览官网的在线示例;
5.  测试你的打印网页。

[b]2019/11/20 更新[/b]

yxtimes 发表于 2019-8-2 13:39

jcp-vue和jcp.js的区别在哪里

这个和其他下载的jcp.js的区别在哪里?看到了里面有一段关于vue的注释,不考虑注释的情况下,是否其他部分都和jcp.js一致?其实我想问的是,以后jcp升级的时候,是否可以直接拿新的来用,还是需要等vue的专门版本...

admin 发表于 2019-8-4 15:38

这个jcp-vue.js与 jcp.js是不同的,不仅是注释不同,如果有版本更新,需要得到相应版本的 jcp-vue.js

yxtimes 发表于 2019-8-6 17:43

以后会随着jcpfree的版本更新同步更新吗

那请问,会随着jcpfree的版本更新,一并得到更新吗?现在用的jcpfree,但希望能一直跟着更新...
另外,其实现在vue的项目也正常使用了jcpfree,只不过是直接把[color=#50fa7b][font=Consolas, &quot][size=16px]doPrint[/size][/font][/color]方法直接写在了项目的index.html里面,同时js和[color=#50fa7b][font=Consolas, &quot][size=16px]getJCP[/size][/font][/color]方法也都写在了首页的html
测试可用.
但官方给出vue专版的自然是最好了....

asdfgh 发表于 2019-9-2 16:01

vue中使用报undefined

Vue项目中使用上述案例弹出undefined,可以获取到getJCP但是打印就报错,是什么原因

admin 发表于 2019-9-3 10:01

请确保你的版本是最新的,本贴中的vue扩展,只能配合新版本有效。

luoweiwi 发表于 2019-9-5 11:39

这个jcp-vue 引入之后 报错了getJCP is not defined 请问解决 (同样的方法引入jcp.js就不会报错)

whisky__ 发表于 2019-9-6 14:14

jcp-vue.js和jcp控件都已经是最新的了,仍然是undefined

admin.chi 发表于 2019-9-11 16:17

同样,使用最新的控件,点击打印还是undefined

胡晓晓 发表于 2019-11-13 10:58

为什么下载文件 提示权限不足?

为什么下载文件 提示权限不足?

admin 发表于 2019-11-13 13:10

问题描述太简单,无法判断,请截图

admin 发表于 2019-11-20 17:03

请用一楼指出的下载地址,下载更新后的版本。

test101 发表于 2020-9-29 16:58

<div><div style="background-color: rgb(30, 30, 30); font-family: Consolas, &quot;Courier New&quot;, monospace; line-height: 19px; white-space: pre; color: rgb(212, 212, 212);"><div><span style="color: #569cd6;">var</span>&nbsp;<span style="color: #9cdcfe;">myDoc</span>&nbsp;=&nbsp;{</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #9cdcfe;">documents&nbsp;:</span>&nbsp;{</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #9cdcfe;">html:result //HTML拼接字符串变量</span></div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;<span style="color: #6a9955;">//&nbsp;打印页面(div)们在本文档中</span></div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #9cdcfe;">copyrights&nbsp;:</span>&nbsp;<span style="color: #ce9178;">'杰创软件拥有版权&nbsp;&nbsp;www.jatools.com'</span>&nbsp;<span style="color: #6a9955;">//&nbsp;版权声明必须</span></div></div><div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Consolas, &quot;Courier New&quot;, monospace; line-height: 19px; white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};</div><div style="background-color: rgb(30, 30, 30); font-family: Consolas, &quot;Courier New&quot;, monospace; line-height: 19px; white-space: pre; color: rgb(212, 212, 212);"><span style="color: #569cd6;">var</span>&nbsp;<span style="color: #9cdcfe;">jcp</span>&nbsp;=&nbsp;<span style="color: #dcdcaa;">getJCP</span>(); //这一行正常</div></div><div><div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Consolas, &quot;Courier New&quot;, monospace; line-height: 19px; white-space: pre;"><span style="color: #9cdcfe;">jcp</span>.<span style="color: #dcdcaa;">printPreview</span>(<span style="color: #9cdcfe;">myDoc</span>,&nbsp;<span style="color: #569cd6;">false</span>); //报错了如下</div></div><div>jcp-vue.js?653a:23 Uncaught SyntaxError: Unexpected token p in JSON at position 0</div><div>&nbsp; &nbsp; at parse (&lt;anonymous&gt;)</div><div>&nbsp; &nbsp; at eval (jcp-vue.js?653a:23)</div><div>&nbsp; &nbsp; at Object.sOYKB (jcp-vue.js?653a:23)</div><div>&nbsp; &nbsp; at Object.fhlRG (jcp-vue.js?653a:23)</div><div>&nbsp; &nbsp; at XMLHttpRequest._0xd0c594.&lt;computed&gt; (jcp-vue.js?653a:23)</div>

admin 发表于 2020-9-29 18:02

请下载 [url]http://print.jatools.com/download/jcp4vue.zip[/url]

并使用里面的  setup.exe ,和 jcp-vue.js  , 两个一定要配套。

test101 发表于 2020-10-5 17:41

下面这个附件中的报错怎么解决?

麻烦看下这个报错是为什么呢,打印着突然这样了,现在是在Vue中使用的,也安装了对应版本了

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.