0
我使用the widget factory pattern创建了一个小型jQuery小部件。它在本地工作正常,但将代码推送到Heroku时,它不再工作。自定义jQuery小部件在Heroku上无法正常工作
如果我创建一个小的测试应用程序如下所示:
(function ($, undefined) {
$.ui.mytest = {
_create: function() {
alert('test');
},
destroy: function() {
// if using jQuery UI 1.8.x
$.Widget.prototype.destroy.call(this);
// if using jQuery UI 1.9.x
//this._destroy();
},
options:{}
};
$.widget("ui.mytest", $.ui.mytest);
})(jQuery);
它将本地打印警报,但在生产中,当资产被编译,我得到以下错误:
Uncaught TypeError: Cannot read property 'length' of undefined application-2ecb4e7c4dcb5be5c5d9884cdb6c266c.js:14
Uncaught TypeError: Object [object Object] has no method 'mytest'
奇怪的是,我在生产中可以在我的控制台上调用$.ui.mytest
,它实际上存在。任何帮助将不胜感激。