我有两种布局,例如:
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'
}
});
我想在Layout1的region2中添加Layout2。或者我想将布局嵌套在布局内。任何帮助将不胜感激。
最佳答案
布局直接从 ItemView 扩展,因此在 marionette 中创建嵌套布局是无缝的。
在 Layout1 的 onRender 中,您应该有以下代码:
onRender: function(){
this.region2.show(new Layout2({
...//code here
}));
}
关于javascript - Marionette 中布局内的布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20391684/