Javascript 未设置本地存储
我用的是离子2。正在尝试在本地存储中设置字符串Javascript 未设置本地存储,javascript,local-storage,ionic2,Javascript,Local Storage,Ionic2,我用的是离子2。正在尝试在本地存储中设置字符串 import { Storage } from '@ionic/storage'; constructor(public storage: Storage) { } createChat(chatItem: any): void { this.storage.ready().then(() => { var jsonString = JSON.stringify(chatItem);
import { Storage } from '@ionic/storage';
constructor(public storage: Storage) {
}
createChat(chatItem: any): void {
this.storage.ready().then(() => {
var jsonString = JSON.stringify(chatItem);
this.storage.set('chat/' + chatItem.$key + '/', jsonString);
});
}
然而,当我看到Chrome的开发者工具时,这个值并没有设置
感谢您的帮助。根据
在web上运行或作为渐进式web应用程序运行时,存储将
尝试按该顺序使用IndexedDB、WebSQL和localstorage
因此,它没有设置是正确的:您应该查看您的Chrome
IndexedDB
而不是localStorage
是的,它就在那里。非常感谢你