我想在我的应用程序中使用backbone.localStorage.js插件,这是一个代码示例:
Module.Vehicles = Backbone.Collection.extend({
initialize : function(options) {
this.customerId = options.customerId;
},
url : function() {
var url = App.Config.RESTPath + '/vehicle';
if(this.customerId) {
url = url + '?customerId='+this.customerId;
}
return url;
},
localStorage: new Backbone.LocalStorage("vehicles"),
model : Module.Vehicle,
parse : function(response) {
this.allVehiclesNumber = response.allVehiclesNumber;
this.customers = response.customers;
return response.vehicles;
}
});
Module.getVehicles = function(customerId) {
var result = new Module.Vehicles({
'customerId' : customerId
});
result.fetch();
return result;
};
如果我在该行中添加评论,一切都很好(收藏有适当的记录):
localStorage: new Backbone.LocalStorage("vehicles"),
但如果不是注释端,则没有记录获取。
我错过了什么?
BR,托马斯。