Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未设置本地存储_Javascript_Local Storage_Ionic2 - Fatal编程技术网

Javascript 未设置本地存储

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);

我用的是离子2。正在尝试在本地存储中设置字符串

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

是的,它就在那里。非常感谢你