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

 

posted on 2019-03-27 16:36  一只傻阿贝哟  阅读(336)  评论(0编辑  收藏  举报

导航