0

如何将 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每个集合吗?

谁能帮我吗?

提前致谢...

4

0 回答 0