バックボーンのイベントシステムに問題があります。バックボーンlistenToはjquery関数をハンドラとして起動しません
jquery関数をコールバックとして直接渡すことはできますか?
次のコードないの火災の表示/非表示方法:
initialize: function() {
this.render();
this.logoutButton = $('#logout-button');
this.logoutButton.hide();
this.listenTo(this.model, 'loginSuccessEvent', this.logoutButton.show);
this.listenTo(this.model, 'logoutSuccessEvent', this.logoutButton.hide);
},
私はこれに変更した場合でも、それは完璧に動作します:fine manualから
initialize: function() {
this.render();
this.logoutButton = $('#logout-button');
this.logoutButton.hide();
this.listenTo(this.model, 'loginSuccessEvent', this.showButton);
this.listenTo(this.model, 'logoutSuccessEvent', this.hideButton);
},
showButton: function() {
this.logoutButton.show();
},
hideButton: function() {
this.logoutButton.hide();
}