如何将模型的属性传递给 collectionOptions?当我尝试像那样传递 param0 时,然后this
被引用window
到MyModel
实例:
var MyModel = Backbone.RelationalModel.extend({
defaults: {
param0: null,
},
relations: [
{
type: Backbone.HasMany,
key: 'others',
relatedModel: 'OtherModel',
collectionType: 'OtherModelCollection',
collectionOptions: {param0: this.get('param0')}
}
]
});