在调用模型后自定义服务器响应的好方法是fetch()
什么?
我问的原因是因为我正在处理一个模型有几个子模型的情况。从服务器返回的数据需要在子模型之间进行拆分。
例子:
// A call to "fetch()" on this model needs to split up the returned data
// between the two child models. Once this happens, their 'change'
// events should fire and update their respective views.
var ParentModel = Backbone.Model.extend({
initialize: function(){
this.childModel_01 = new ChildModel_01({});
this.childModel_02 = new ChildModel_02({});
}
})
var ChildModel_01 = Backbone.Model.extend({});
var ChildModel_02 = Backbone.Model.extend({});
非常感谢!