1
我無法渲染Marionette LayoutView並在該佈局中顯示區域。Backbone Marionette LayoutView無法找到DOM元素
我的佈局文件:
template: '#fooTemplate',
regions: {
barRegion: '.bar'
}
我的HTML:
<script id="fooTemplate" type="text/template">
<div id="fooDiv">
<div class="bar">
</div>
</div>
</script>
呈現的佈局和顯示區域代碼:
var FooLayout = require('./browserify/path');
var fooLayout = new FooLayout({el:"#fooDiv"})
collectionView = new CollectionView({
collection: collection
});
fooLayout.render();
fooLayout.barRegion.show(collectionView);
我得到一個錯誤未被捕獲的錯誤: DOM中的「el」#foo .bar必須存在
我在LayoutView的功能中缺少什麼?我有一個類似的例子工作得很好,但由於某種原因,我無法複製它。