1.设置localStorage

 window.localStorage.setItem(vm.mobileSelf,JSON.stringify(contactInfo));
vm.mobileSelf也可以换成"随便的数",
JSON.stringify(contactInfo)也还可以换成"你要存的随便的数",反正就是字符串
获取localStorage里面的值
 var contactInfos=JSON.parse(localStorage.getItem(vm.mobileSelf));

这里的vm.mobileSelf就对应你刚刚存的"随便的数",那么得到的就是"你要存的随便的数",将他赋值给了contactInfos.

2.获取cookie和设置cookie.

设置,如果是你要存这个username,key就是name,

document.cookie="name="+username;

获取

vm.mobileSelf=$.cookie('name')

  

 

 

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-12-19
  • 2021-05-18
猜你喜欢
  • 2021-12-19
  • 2021-12-31
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案