有沒有方法可以改變模型上的屬性而不會發生更改事件?如果您現在通過{"silent":true}
,下次更改屬性時,將會觸發沉默更改事件。如果不觸發更改事件,我可以安全地更改屬性嗎?在Backbone.js中默默地改變模型屬性?
從變化,骨幹0.9.2:
// Silent changes become pending changes.
for (var attr in this._silent) this._pending[attr] = true;
// Silent changes are triggered.
var changes = _.extend({}, options.changes, this._silent);
this._silent = {};
for (var attr in changes) {
this.trigger('change:' + attr, this, this.get(attr), options);
{silent:true}延遲個體更改的問題:attr事件在Backbone 0.9.10中得到了修復。 – parliament 2013-07-28 22:32:33