簡體   English   中英

更改骨干模型默認屬性

[英]Changing Backbone Model defaults attribute

我有骨干網視圖。 我希望在某些單擊事件中,我能夠更改模型的默認屬性。

內部視圖初始化使用.on函數( 這里是doc )。 例如:

  initialize: function(options) {
    model.off();  // if you forget to write the line, it works  how many time you rendered this view
    model.on( 'all', this._handleChanges, this); // all or another event  name
  }

編輯

我使用.off()因為在這里我全部寫on 我做off whitch一個我綁定的事件on 有關更多信息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM