[
{
"Id": "de2389905aa5e611b01df677da062200",
"Url": "http://xxx/public/de2389905aa5e611b01df677da062200.jpg",
"Name": "QQ截图20161024095112",
"Width": 741,
"Height": 321,
"Size": 38976,
"CreateTime": "2016-11-08 10:25:08"
},
{
"Id": "8ec148835aa5e611b01df677da062200",
"Url": "http://xxx/public/8ec148835aa5e611b01df677da062200.png",
"Name": "QQ图片20161107095907",
"Width": 1080,
"Height": 1920,
"Size": 4899551,
"CreateTime": "2016-11-08 10:24:46"
},
{
"Id": "8dc148835aa5e611b01df677da062200",
"Url": "http://xxx/public/8dc148835aa5e611b01df677da062200.png",
"Name": "点击游戏详情",
"Width": 1744,
"Height": 1680,
"Size": 59488,
"CreateTime": "2016-11-08 10:24:45"
}
]
js代码:
- function StorageAdd(json)
- {
- var result = localStorage.Image;
- if (result != null) {
- //console.log(result);
- var arr = eval(result);
- arr.unshift(json);
- //console.log(arr);
- var json_str = JSON.stringify(arr);
- //console.log(json_str);
- localStorage.setItem("Image", json_str);
- } else {
- var mycars = new Array();
- mycars.unshift(json);
- localStorage.setItem("Image", JSON.stringify(mycars));
- }
- }
复制代码
|