[英]Including Moment.js in LiveCycle Designer
For few days I've been trying to include the actual Moment.js library in my dynamic PDF which I've created with Adobe Livecycle Designer. 几天来,我一直在尝试使用Adobe Livecycle Designer创建的动态PDF中包含实际的Moment.js库。
We've used an older version (1.7.2) without any problems but now I only get a 'Function not exist' error. 我们使用了较旧的版本(1.7.2),没有任何问题,但是现在我仅收到“功能不存在”错误。
Does anyone have any expierience with this? 有人对此有任何经验吗?
Thanks in advance. 提前致谢。
How to include Moment.js in an Adobe LiveCycle Form: 如何在Adobe LiveCycle表单中包含Moment.js:
Remove all the script up to but not including the second curly brace { : 删除所有脚本,直到但不包括第二个花括号{:
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function()
Remove the rounded parenthesis and semicolon from the end of the minified script 从缩小的脚本的末尾删除圆括号和分号
Add this line to the beginning of the minified script: 将此行添加到缩小脚本的开头:
if (xfa.momentjs == undefined) xfa.momentjs = function()
In the MOMENTJSMIN Script Object add this function after the end of the script: 在MOMENTJSMIN脚本对象中,在脚本结束后添加以下函数:
function getMomentJS(){ return xfa.momentjs(); }
Now your MOMENTJSMIN script object is set up to provide Moment.js to scripts throughout your form. 现在,您的MOMENTJSMIN脚本对象已设置为在整个表单中向脚本提供Moment.js。
To use Moment.js in any of your script, start your script object or event script with this line: 要在任何脚本中使用Moment.js,请使用以下行启动脚本对象或事件脚本:
var moment = MOMENTJSMIN.getMomentJS();
Now you can use moment() anywhere in the script that starts with that line. 现在,您可以在脚本中以该行开头的任何地方使用moment()。 eg:
例如:
var moment = MOMENTJSMIN.getMomentJS();
var jan07 = moment([2007, 0, 29]);
app.alert(moment().format("dddd, MMMM Do YYYY, h:mm:ss a"));
app.alert(jan07.format("dddd, MMMM Do YYYY") + " was " + jan07.fromNow());
app.alert(moment.isDate(new Date()));
What I would check first: 我首先要检查的是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.