Tôi có một ba Backbone Xem lớp thừa kế:Backbone Xem thừa kế - gọi cha mẹ dẫn đến đệ quy
var preventRecursion = 0;
var parentView = Backbone.View.extend({
initialize: function(){
console.log('parentView');
}
});
var nestedChildView = parentView.extend({
initialize: function(){
if (++preventRecursion == 5) {throw "Recursion"};
console.log('nestedChildView');
this.constructor.__super__.initialize.apply(this);
}
});
var nestedNestedChildView = nestedChildView.extend({
initialize: function(){
console.log('nestedNestedChildView');
this.constructor.__super__.initialize.apply(this);
}
});
Khi tôi cố gắng tạo ra nestedNestedChildView:
var t = new nestedNestedChildView();
tôi nhận đệ quy vô hạn: Dưới đây là jsfiddle
Cảm ơn bạn đã trả lời. – Erik