Jul*_*ien 16
Backbone正在检查设置值是否与之前的值相同(请查看https://github.com/documentcloud/backbone/blob/master/backbone.js#L210等).
在您的示例中,数组仍然相同,但内部值已更改.这很难解决.创建数组的新副本似乎是开销.我建议直接在你的采用函数中调用change事件作为解决方案:
adopt: function(newChildsName){
var children_array = this.get('children');
children_array.push(newChildsName);
this.set({children:children_array});
this.trigger("change:children");
}
Run Code Online (Sandbox Code Playgroud)
我建议在骨干github存储库上创建一个问题,可能会添加一个"强制"选项来强制模型上属性的更新(从而触发事件).