内部布局Marionette布局



我有两种布局,比如:

Layout1 = Marionette.Layout.extend({
  template: {
  type: 'handlebars',
  template: Layout1template
},
  regions: {
  region1: '#header',
  region2: '#content'
}

});

Layout2 = Marionette.Layout.extend({
template: {
  type: 'handlebars',
  template: Layout2template
},
  regions: {
  region1: '#contenttop',
  region2: '#contentbottom'
}

});

我想在布局1的区域2中添加布局2。或者我想在布局中嵌套布局。如有任何帮助,我们将不胜感激。

Layout直接从ItemView扩展,因此在提线木偶中创建嵌套布局是无缝的。

在Layout1的onRender中,您应该有以下代码:

onRender: function(){
  this.region2.show(new Layout2({
    ...//code here
  }));
}

最新更新