マリオネット ビューをアプリケーション領域およびレイアウトと組み合わせて動作させようとしていますが、レイアウト内のネストされたビューをレンダリングすることができないようです。
編集:OptionsView
と の両方がでBreadcrumbsView
レンダリングされることを期待していNavigationLayout
ましたが、ナビゲーション領域でレンダリングする必要があります。ただし、ナビゲーション領域はまったくレンダリングされません。コンソールにエラーは表示されません。
私の構造は次のとおりです。
- Navigation region
- Navigation layout
- Options region
- Breadcrumbs region
- Content region
ItemView
をナビゲーション領域に割り当てると、期待どおりに機能します。
App = new Backbone.Marionette.Application();
App.addRegions({
'nav': '#nav',
'content': '#content'
});
var NavigationLayout = Backbone.Marionette.Layout.extend({
template: '#nav-template',
regions: {
'breadcrumbs': '#breadcrumbs',
'options': '#options'
}
});
var BreadcrumbsView = Backbone.Marionette.ItemView.extend({
template: '#breadcrumbs-template'
});
var OptionsView = Backbone.Marionette.ItemView.extend({
template: '#options-template'
});
var ContentView = Backbone.Marionette.ItemView.extend({
template: '#content-template'
});
App.addInitializer(function(options) {
var navigationLayout = new NavigationLayout();
App.nav.show(navigationLayout);
App.content.show(new ContentView());
navigationLayout.breadcrumbs.show(new BreadcrumbsView());
navigationLayout.options.show(new OptionsView());
});
$(function() {
App.start();
});
縮小されたテストケースはここにあります