1
특정 속성이 변경되었을 때 백본 모델이 맞춤 이벤트를 시작하는 좋은 방법은 무엇입니까?백본 - 특정 속성이 변경 될 때 이벤트를 발생시키는 모델
var model = Backbone.Model.extend({
initialize: function(){
// Bind the mode's "change" event to a custom function on itself called "customChanged"
this.on('change', this.customChanged);
},
// Custom function that fires when the "change" event fires
customChanged: function(){
// Fire this custom event if the specific attribute has been changed
if(this.hasChanged("a_specific_attribute") ){
this.trigger("change_the_specific_attribute");
}
}
})
감사 :
는 지금까지 내가있어 최고입니다!
아, 훌륭함. 감사! –