我搜索了很多,但未能找到合适的答案。 我试图覆盖Marionette CompositeView中定义的函数。我用一个新的类扩展了复合视图,该函数应该覆盖默认值,一切都按预期工作,但问题是父/原始类(ClassA)仍然调用旧函数而不是新函数(ClassB)
var ClassA = Backbone.Marionette.CompositeView.extend({
initialize: function(){
this.onValueAdded();
// now the onValueAdded of ClassB should be called, or at least this is what im trying to accomplish
},
onValueAdded: function () {
}
});
var ClassB = ClassA.extend({
onValueAdded: function () {
alert('this should get fired');
}
});
答案 0 :(得分:0)