当我覆盖a的clone()方法时Backbone.Model,有没有办法从我的植入中调用这个overriden方法?像这样的东西:
var MyModel = Backbone.Model.extend({
clone: function(){
super.clone();//calling the original clone method
}
})
Run Code Online (Sandbox Code Playgroud) 我需要initialize从继承的MyModel类中调用父类的方法,而不是像我今天那样完全覆盖它.
我怎么能这样做?
这是我的代码现在看起来的样子:
BaseModel = Backbone.Model.extend({
initialize: function(attributes, options) {
// Do parent stuff stuff
}
});
MyModel = BaseModel.extend({
initialize: function() {
// Invoke BaseModel.initialize();
// Continue doing specific stuff for this child-class.
},
});
Run Code Online (Sandbox Code Playgroud)