[英]Changing Backbone Model defaults attribute
我有骨干網視圖。 我希望在某些單擊事件中,我能夠更改模型的默認屬性。
內部視圖初始化使用.on函數( 這里是doc )。 例如:
.on
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 。 有關更多信息
.off()
on
off
[英]Changing nested attribute with model.set in Backbone
[英]Backbone class model not inheriting defaults
[英]Backbone Model defaults not being overwrote by Model data
[英]Backbone model undefined attributed in defaults and scope
[英]Set values to the folded defaults in Backbone.Model
[英]Extending the defaults of a Model superclass in Backbone.js
[英]backbone.js updating model defaults
[英]Backbone and changing model attributes
[英]Backbone model attribute error
[英]listenTo model attribute in backbone
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.