我想阻止默认事件 onclick,但我有一个问题。在其他视图中,这些事件有效,但在此集合视图中无效。
App.View.Actions = Backbone.View.extend({
el: '#actions',
template: $('#action-tpl').html(),
//// !!! CALLBACK DOESN'T WORKS
events: {
'click .some-link': function(e) {
e.preventDefault();
console.log('!!!!!!');
}
},
initialize: function() {
/// Event object extends Backbone.Events
Event.on('actions:dispayActions', this.render, this);
},
render: function(data) {
/// Render logic
}
});
此链接的事件:
<a href="http://example.com" class="some-link">Test</a>
此视图以
var actions = new App.View.Actions({ collection: new App.Collection.Actions([{...}, {...}]) });
我做错了什么?