Nesting Marionette regions, layouts and views

久未见 提交于 2019-11-29 04:10:20
Derick Bailey

Ok, finally found the problem: You can't name a region options in a layout.

All of the regions that are defined in a Layout are directly attached to the layout instance. So, a region defined like this:


Layout.extend({
  regions: {
    options: "#options"
  }
});

ends up setting the layoutInstance.options to the Region instance. This is a problem because Backbone.View defines and uses the options for other purposes.

Renaming the region to anything other than an existing keyword or attribute used by any existing view will fix this.


Layout.extend({
  regions: {
    optionRegion: "#options"
  }
});

Working JSFiddle here: http://jsfiddle.net/tegon/64ovLf64/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!