Marionette 无法将子视图插入到布局中
我正在使用木偶网.主干网创建一个Web应用程序,我得到了一个模块,可以创建一个布局并向其中添加三个子视图 布局渲染良好,但区域没有用每个子视图填充。 我错过了什么。我在控制台中没有发现错误 这是我的控制器:Marionette 无法将子视图插入到布局中,marionette,Marionette,我正在使用木偶网.主干网创建一个Web应用程序,我得到了一个模块,可以创建一个布局并向其中添加三个子视图 布局渲染良好,但区域没有用每个子视图填充。 我错过了什么。我在控制台中没有发现错误 这是我的控制器: @Appic.module "ProjectsApp.Add", (Add, App, Backbone, Marionette, $, _) -> Add.Controller = addProject: -> @layout
@Appic.module "ProjectsApp.Add", (Add, App, Backbone, Marionette, $, _) ->
Add.Controller =
addProject: ->
@layout = @getLayoutView()
@layout.on "show", =>
@showLeft
@showContent
@showRight
App.mainRegion.show @layout
showLeft: ->
leftView = @getLeftView
@layout.leftRegion.show leftView
showContent: ->
contentView = @getContentView
@layout.contentRegion.show contentView
showRight: ->
rightView = @getRightView
@layout.rightRegion.show rightView
getLeftView: ->
new Add.Left
getContentView: ->
new Add.Form
getRightView: ->
new Add.Right
getLayoutView: ->
new Add.Layout
这是模块的我的视图部分
@Appic.module "ProjectsApp.Add", (Add, App, Backbone, Marionette, $, _) ->
class Add.Layout extends App.Views.Layout
template: "projects/add/templates/add_layout"
regions:
leftRegion: "#left-region"
contentRegion: "#content-region"
rightRegion: "#right-region"
class Add.Left extends App.Views.ItemView
template: "projects/add/templates/_left"
class Add.Right extends App.Views.ItemView
template: "projects/add/templates/_right"
class Add.Form extends App.Views.ItemView
template: "projects/add/templates/_form"
在show方法中,您是将指针指定给函数,而不是函数结果。尝试:
showLeft: ->
leftView = @getLeftView()
@layout.leftRegion.show leftView
showContent: ->
contentView = @getContentView()
@layout.contentRegion.show contentView
showRight: ->
rightView = @getRightView()
@layout.rightRegion.show rightView