我正在尝试使用带有主干和requirejs的FullCalender.js。麻烦的是我似乎无法在requirejs设置中声明它。
到目前为止,我已将其添加到View define语句中,但这不起作用。我得到:
Uncaught TypeError: Object #<HTMLDivElement> has no method 'fullCalendar'
这就是观点:
define([
'jqueryui',
'underscore',
'backbone',
'utils',
'fullcalendar',
'Collection/EventCollection',
'model/EventModel'
], function ($, _, Backbone, Utils, fullCalendar, EventCollection, EventModel){
var EventView = Backbone.View.extend({
el: "#singlecolumn",
initialize: function(models){
_.bindAll(this, "render");
this.eventCollection = models.model;
this.eventCollection.bind('reset', this.addAll);
this.render();
},
render: function() {
console.log("Rendering Calendar...");
this.el.fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay',
ignoreTimezone: false
},
selectable: true,
selectHelper: true,
editable: true
});
},
addAll: function(){
console.log("Rendering Calendar...");
this.el.fullCalendar('addEventSource', this.eventCollection.toJSON());
}
});
return EventView;
});
任何人都已经这样做了吗?