如何将4个子视图合并为1个主视图?我使用Backbone.Layoutmanager
define(['app','backbone', 'modules/cars', 'modules/motorcycles', 'modules/bikes', 'modules/quads'],
function (App, Backbone, Cars, Motorcycles, Bikes, Quads){
Motors.View = Backbone.View.extend({
tagName: 'ul',
beforeRender: function(){
var carsCollection = new Cars.CarsCollection();
this.insertView(new Cars.View({collection: carsCollection }));
carsCollection.fetch();
var motorcycleCollection = new Motorcycle.MotorcycleCollection();
this.insertView(new Motorcycle.View({collection: motorcycleCollection}));
motorcycleCollection.fetch();
var bikesCollection = new Bikes.BikesCollection();
this.insertView(new Bikes.View({collection: bikesCollection}));
bikesCollection.fetch();
var quadsCollection = new Quads.QuadsCollection();
this.insertView(new Quads.View({collection: quadsCollection}));
quadsCollection.fetch();
}
});
return Motors;
});
我应该删除每个集合上的this.insertView
吗?
任何人都可以帮助我吗?
提前致谢...