0
我最近开始在Backbone Library中工作。目前我正在研究的骨干视图有子视图,所以我认为我可以覆盖remove()
方法并在那里执行清理工作。删除骨干查看和解除绑定事件
下面是代码,
var myView = Backbone.View.extend({
...
remove: function(){
this.childView1.remove();
this.childView2.remove();
Backbone.View.prototype.unbind.call(this);
Backbone.View.prototype.remove.call(this);
}
});
论SO看到一些实例中,在其中unbind()
和remove()
被称为顺序反转手段第一它们被调用remove()
然后unbind()
。我上面的顺序是正确还是错误?