首先,localStorage中只能存储字符串
所以,存储对象数组,必须先转成字符串再存储
localStorage.pList=JSON.stringify([]);
需要时,再将localStorage中的字符串转成对象数组
var tmp_pList=JSON.parse(localStorage.pList);
参考链接:
点击打开链接
首先,localStorage中只能存储字符串
所以,存储对象数组,必须先转成字符串再存储
localStorage.pList=JSON.stringify([]);
需要时,再将localStorage中的字符串转成对象数组
var tmp_pList=JSON.parse(localStorage.pList);
参考链接:
点击打开链接