dataformat(arr) {
var newArr = [];
arr.forEach((address, i) => {
let index = 0;
let alreadyExists = newArr.some((newAddress, j) => {
if (address.createTime.substring(0,10) == newAddress.time.substring(0,10)) {
index = j;
return true;
}
});
if (!alreadyExists) {
newArr.push({
time: address.createTime.substring(0,10),
items:[address]
});
} else {
newArr[index].items.push(address);
}
});
this.allList = newArr;
}
效果图 。
U{`9E$REMCMP~O2Y0$EDP8M.png
后台返回的数据,
LTD_{{K$%{3ND`4I%T3}9$R.png格式化以后的数据
SKCEC(74IINP(PE7YCNCD$1.png
网友评论