Nio*_*ron 2 javascript livecycle livecycle-designer momentjs
几天来,我一直在尝试将实际的 Moment.js 库包含在我使用 Adobe Livecycle Designer 创建的动态 PDF 中。
我们使用旧版本(1.7.2)没有任何问题,但现在我只收到“函数不存在”错误。
有人有这方面的经验吗?
提前致谢。
如何将 Moment.js 包含在 Adobe LiveCycle 表单中:
删除直到但不包括第二个大括号 { 的所有脚本:
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function()
Run Code Online (Sandbox Code Playgroud)删除缩小脚本末尾的圆括号和分号
将此行添加到缩小脚本的开头:
if (xfa.momentjs == undefined) xfa.momentjs = function()
Run Code Online (Sandbox Code Playgroud)在 MOMENTJSMIN 脚本对象中,在脚本末尾添加此函数:
function getMomentJS(){
return xfa.momentjs();
}
Run Code Online (Sandbox Code Playgroud)现在,您的 MOMENTJSMIN 脚本对象已设置为向整个表单中的脚本提供 Moment.js。
要在任何脚本中使用 Moment.js,请使用以下行启动脚本对象或事件脚本:
var moment = MOMENTJSMIN.getMomentJS();
Run Code Online (Sandbox Code Playgroud)
现在您可以在脚本中以该行开头的任何位置使用 moment() 。例如:
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()));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
581 次 |
| 最近记录: |