【发布时间】:2015-11-26 22:44:30
【问题描述】:
我有一个带有标题(选择过滤器)的模板和带有集合模型列表的部分。视图 (Backbone.Marionette.CompositeView) 总是在第一次加载模板包装器和模型时自动呈现。
有没有办法在第一次加载时只渲染模板包装器?
【问题讨论】:
标签: backbone.js render marionette
我有一个带有标题(选择过滤器)的模板和带有集合模型列表的部分。视图 (Backbone.Marionette.CompositeView) 总是在第一次加载模板包装器和模型时自动呈现。
有没有办法在第一次加载时只渲染模板包装器?
【问题讨论】:
标签: backbone.js render marionette
没有。但您可以随时切换模板。
initialize: function(){
this.template = template1(); // initial render will use template 1
},
onRender: function(){
this.template = template2(); // point to template 2 after every render. So each subsequesnt render will use template 2.
},
doStuff: function(){
this.render(); // call render when doing stuff
}
【讨论】: