剑轩

js遍历localStorage的键值对

电脑版发表于:2018/12/14 14:40


  
  //遍历本地存储localStorage
        for (var i = 0; i < localStorage.length; i++) {
            var key = localStorage.key(i); //获取本地存储的Key
            console.log(key);
            console.log(localStorage.getItem(key));//所有value
            console.log("---------------------------------");
        }


关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢