我现在很坚持。我收到以下错误:
TypeError: listenTo is undefined
return listenTo.call(this, evtSource, events, _.bind(callback, context));
我不明白为什么会发生此错误。我真的不知道listenTo 期望什么。当我更改Backbone.Marionette.CompositeView
为BackboneView
工作正常时。有任何想法吗?
请参见下面的代码:
define([
"jquery",
"backbone",
"marionette",
],
function($, Backbone, Marionette){
var CompositeView = Backbone.Marionette.CompositeView.extend({
// The DOM Element associated with this view
el: ".example",
// View constructor
initialize: function() {
// Calls the view's render method
this.render();
},
// View Event Handlers
events: {
},
// Renders the view's template to the UI
render: function() {
// Setting the view's template property using the Underscore template method
//this.template = _.template('ddd', {});
// Dynamically updates the UI with the view's template
this.$el.html('123123123123123123123123');
// Maintains chainability
return this;
}
});
// Returns the View class
return CompositeView;
}
);