JS浏览器Session存取数据

Posted xiaoqi2018

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JS浏览器Session存取数据相关的知识,希望对你有一定的参考价值。

vm.indexdata.indexId = id;
 vm.indexdata.indexName = name;
 var tempIndex = JSON.stringify(vm.indexdata);
 window.sessionStorage["searchIndex"] = tempIndex;


//调用取值
JSON.parse(window.sessionStorage.getItem("searchIndex")).indexId
JSON.parse(window.sessionStorage.getItem("searchIndex")).indexName)

//判断session是否存在
 if (window.sessionStorage["searchIndex"]) 
{
}

//移除session
window.sessionStorage.removeItem("searchIndex");

 

以上是关于JS浏览器Session存取数据的主要内容,如果未能解决你的问题,请参考以下文章