本次存储存数组对象

var arrLi = [{"search_content":"火锅"},{"search_content":"火锅1"},{"search_content":"火锅2"}];//定义

localStorage.setItem("searchLI",JSON.stringify(arrLi));

获取

var arrLi1 = JSON.parse(localStorage.getItem("searchLI"));

累加:

arrLi1.push({"search_content":"火锅"})
;
修改:

localStorage.setItem("searchLI",JSON.stringify(arrLi1));


全部清除

this.xxx = [];
localStorage.removeItem('searchLI');

原文地址:https://www.cnblogs.com/shaozhu520/p/10286355.html