$scope.data=[
{"time":"2017/06/23","money":"3000","type":"RMB"},
{"time":"2017/06/24","money":"4000","type":"RMB"},
{"time":"2017/07/23","money":"3000","type":"RMB"},
{"time":"2017/07/23","money":"3000","type":"RMB"},
{"time":"2017/07/23","money":"3000","type":"RMB"}
];
請求到的數據類似這樣,要根據time字段的時間,根據月份顯示數據,怎樣把六月和七月的數據過濾開
比如渲染到頁面要這樣顯示:
6月
23號金額:3000 類別:人民幣
24號金額:4000 類別:人民幣
7月
23號金額:3000 類別:人民幣
24號金額:4000 類別:人民幣
25號金額:5000 類別:人民幣
怪我咯2017-06-28 09:29:13
var arr = {};
for(var i=0;i<$scope.data.length;i++){
var key = $scope.data[i].time.split('/')[1];
arr[key].push($scope.data[i])
}
return arr;
純手寫,沒測,只是寫個思路,將物件進一步格式化