谁能告诉我为什么这段代码不会创建本地存储的条目?
myLocalStore.load();
var now = new Date();
var cardId = (now.getTime()).toString() + (this.getRandomInt(0, 100)).toString();
var entry1 = { id: cardId, dateCreated: now, title: 'The Title', narrative: 'the Text' };
var newRecord = new PinYin.model.Default(entry1);
myLocalStore.add(newRecord);
myLocalStore.sync();
console.log(entry1);
控制台输出
Object{id: "136575772251069", dateCreated: Fri Apr 12 2013 17:08:42 GMT+0800 (Taipei Standard Time), title: "The Title", narrative: "the Text"}
这是正确的格式,所以我不确定我做错了什么......
如果我替换 myLocalStore.add(entry1); 与 myLocalStore.add('value');
然后我将以下输入到本地存储中
{"id":"ext-record-1","dateCreated":null,"title":null,"narrative":null}