【发布时间】:2013-06-14 17:47:51
【问题描述】:
我是 Marionette.js 的新手,在重构现有的 Backbone.js 代码时,我注意到 Marionette 视图 (itemview) 上的两个回调在我看来很相似,即 onRender 和 onShow。有什么区别和更好的使用方式?
但是,查看源代码,我认为“渲染”和“显示”事件都在“视图初始化”中引发。
constructor: function(){
_.bindAll(this, "render");
var args = Array.prototype.slice.apply(arguments);
Backbone.View.prototype.constructor.apply(this, args);
Marionette.MonitorDOMRefresh(this);
this.listenTo(this, "show", this.onShowCalled, this);
}
【问题讨论】:
标签: backbone.js view marionette