이 같은 세 가지 백본 전망이 :백본보기 상속
ParentView = Backbone.View.extend({
addUsers : function()
{
console.log("Parent's Add User");
},
addProject : function()
{
console.log("Parent's Add Project");
}
});
ChildView = ParentView.extend({
addProject : function()
{
var self = this;
console.log("Child's add Project");
self.constructor.__super__.addProject.apply(self);
}
});
GrandChildView = ChildView.extend({
addItem : function()
{
var self = this;
self.addProject();
},
addUsers : function()
{
var self = this;
console.log("Grand Child's Add users");
self.constructor.__super__.addUsers.apply(self);
}
});
var vChild = new ChildView();
vChild.addProject(); // works fine, by calling it own and parent's functions.
var vGrandChild = new GrandChildView();
vGrandChild.addUsers(); // This throws Maximum call stack size exceeded error,
내가 GrandChildView의 새로운 인스턴스를 생성하고 그 ADDUSERS 메소드를 호출, 내가 그 becuase 추측, 최대 스택 크기를 초과 발생 그것은 계속 부름을 계속합니다. 그러나 알아낼 수는 없습니다. 이유는 super의 메소드를 호출하는 것 같습니다.
감사합니다.
JS에서 '슈퍼'로 불을 피우고 있다고 생각합니다. :) – fguillen