最近在用backbone开发项目时,遇到在model的change事件被重复绑定的问题。我在来回切换几次view(页面)的时候,change就会被重复绑定几次。代码如下:varItemView=Backbone.View.extend({tagName:'div',className:'acc-item',initialize:function(opts){this.template=opts.mainView.itemTpl;this.dayView=opts.dayView;this.listenTo(this.model,'destroy',this.remove);this.listenTo(this.model,'change',this.render);},render:function(){returnthis;},remove:function(){}});请教一下,该怎么解决
慕码人2483693
相关分类