我正在尝试使用骨干。木偶来管理我的网站布局。现在我有了一个类layout。js。coffee
class Views.Layout extends Marionette.Layout
template: '#layout-template'
regions:
main: '#main-region'
options: '#integration-options'
我知道我应该有一个模板叫做layout-template。但我可以把这个布局模板文件?参考marionette的CompositeView的用法,我通常将模板放在templates文件夹中,在CompositeView中,我可以直接使用
template: 'books/books'
那么模板前面的"#"是什么意思呢?我应该如何命名这个模板?
如果我想显示布局视图,我是否应该在控制器中做点什么,比如
...
book.fetch
success ->
layout = new Books.Views.Layout
layout.render()
MyApp.main.show layout
有人能帮我吗?我找不到任何类似的教程或例子
方案如下:
LayoutView extends Marionette.LayoutView
regions:
main: '#main'
other: '#other'
ViewA extends Marionette.CompositeView
ViewB extends Marionette.CompositeView
layoutView = new LayoutView
viewA = new ViewA
viewB = new ViewB
app.main.show layoutView
layoutView.main.show ViewA
layoutView.other.show ViewB