2013-09-28 161 views
1

我有兩個骨幹視圖延伸,並且我想使用將來自兩個骨幹視圖從兩個視圖

廠景被擴展第三視圖= Backbone.View.extend({}); view2 = Backbone.View.extend({}); VIEW3 (從廠景和視圖2擴展),任何人都可以幫我

回答

0

我還沒有嘗試過,但這個應該工作,摘自:https://gist.github.com/alassek/1227770

(function() { 

    function extendEach() { 
    var args = Array.prototype.slice.call(arguments), 
     child = this; 

    _.each(args, function (proto) { 
     child = child.extend(proto); 
    }); 

    return child; 
    } 

    Backbone.Model.extendEach  = 
    Backbone.Collection.extendEach = 
    Backbone.Router.extendEach  = 
    Backbone.View.extendEach  = extendEach; 

})(); 

ClassC = Backbone.Model.extendEach(ClassA, ClassB, [properties])