1. getCook :

设定setCookie值

let setCookie = setCookie('wan',data,7);

function setCookie(c_name,value,expiredays){
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate)
}

获取getCookie

let getCookie = getCookie('wan');

function getCookie(c_name){
if (document.cookie.length>0){
var c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1){
c_start=c_start + c_name.length+1
var c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
}
}
return undefined;
}

localStorage取值?

window.localStorage.setItem("headers_vendor", wxHeaders); 设定

window.localStorage.getItem("headers_vendor"); 取值

localStorage:常用的api

添加键值对:localStorage.setItem(key,value)

获取键值:localStorage.getItem(key)

删除键值对:localStorage.removeItem(key)。

清除所有键值对:localStorage.clear()。

获取localStorage的属性名称(键名称):localStorage.key(index)。

最新文章

  1. {Reship}{KMP字符串匹配}
  2. 转载---ViewPager,PagerAdapter,FragmentPagerAdapter和FragmentStatePagerAdapter的分析对比
  3. cookie的操作
  4. POJ 2449 A*+SPFA
  5. sharepoint 中用自带的download.aspx实现文件的下载,中文文件名编码的问题
  6. [TypeScript] Stopping a TypeScript Build When Errors Are Found
  7. SQL分页小Demo
  8. C# 文件读写异常“正由另一进程使用,因此该进程无法访问该文件”
  9. 本地yum源安装GCC
  10. Qt 外观之一 ——Qt Style Sheet
  11. Django中templates使用的补充
  12. java流和文件 保存字节级数据(写)
  13. 装饰器,栈 ,asyncio 代码
  14. Excel中快捷键Ctrl+End覆盖过多
  15. JNI编程实现(Windows)
  16. Java文档注释导出帮助文档和项目的jar包导入和导出。
  17. Linux基础命令-mkdir
  18. git基础使用——TortoiseGit
  19. Qt监控Arduino开关状态(读取串口数据)
  20. centos7虚拟机安装elasticsearch6.4.x-遇到的坑

热门文章

  1. org-mode记录总结
  2. 洛谷 P4178 Tree
  3. Python之Tab键自动补全
  4. linux CentOS7 安装 Java
  5. pytest-skip详解
  6. (转)Unity Cinemachine插件,实现单目标和多目标之间切换
  7. Schema约束与DTD约束
  8. date -d 对于时间的控制
  9. nodejs的桌面应用(electron)
  10. Vue学习笔记【16】——vue-resource 实现 get, post, jsonp请求