实现本地存储,避免刷新页面数据丢失:

localStorage.setItem 只能存储字符串,

所以在储存的时候先将对象转换为字符串

localStorage.setItem("localKey", JSON.stringify(this.cartGroup))

然后再将字符串转换为对象

方法1: JSON.parse(localStorage.getItem("localKey")

方法2: eval("("+localStorage.getItem("localKey")+")")

最新文章

  1. Python标准模块--linecache
  2. linux 服务的操作
  3. [NOIP2012] 提高组 洛谷P1083 借教室
  4. java使用poi读取ppt文件和poi读取excel、word示例
  5. select_tag in rails about selected not change and onchange()
  6. XML工程配置文件的读写
  7. NUnit Test Adapter----单元测试需要安装这个插件
  8. 直面Javascript面试题算法思路
  9. 【软件工程-Teamwork 3】团队角色分配和团队贡献分分配规则
  10. getopt使用例子
  11. hackerrank:Almost sorted interval
  12. 程序猿学英语—In July the English learning summary
  13. 快速掌握LODOP打印使用方法
  14. 【Android Developers Training】 107. 认知用户当前的行为
  15. 浮动和BFC的学习整理转述
  16. idea 配置 maven 项目
  17. SpringMCV跨域
  18. Email实例
  19. (转)Redis(四)哨兵_sentinel
  20. CXF wsdl2java (转载)

热门文章

  1. git常用命令(测试必备)
  2. 重新学习Spring注解——ICO
  3. no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]]
  4. RabbitMQ六种队列模式-简单队列模式
  5. postfix发邮件失败,日志和postqueue -p提示No route to host
  6. redis使用摘要
  7. 网络协议 5 - ICMP 与 Ping
  8. VueCli3新特性
  9. 一些树上dp的复杂度证明
  10. nginx配置神器