const monthData = this.Mileage.reduce((acc, { day, speed, distance, wagons }) => {
const yearMonths = day.substring(0, 7);
if (acc[yearMonths]) {
acc[yearMonths].speed += speed / 90;
acc[yearMonths].distance += distance / 90;
acc[yearMonths].wagons += wagons;
} else {
acc[yearMonths] = { day, speed, distance, wagons };
}
return acc;
}, {})
monthData.map(({ day, ...rest }) => {
const quarter = ['I', 'II', 'III', 'IV'][Math.floor(+day.substring(5, 7) / 4)];
const year = day.substring(0, 4);
const hash = `${year}-${quarter}`; // "2022-IV"
return { hash, day, ...rest };
})
export default defineComponent({
name: 'CounterButton',
// Компонент должен иметь входной параметр и порождать событие
props: {
count: {
type: Number,
default: 0
}
},
template: `<button type="button" @click="$emit('update:count', count+1)">1</button>`,
methods: {
counter() {
count += 1
}
}
});
this.loaderAbandon = true
api.getWagonsThrow(this.filter_abadon)
.then((response) => {
while(response.data.links.next != null){
this.throwWagons.push()
response.data.links.next++
}
// this.throwWagons = response.data.data
this.amount = response.data.amount
this.total_objects = response.data.total_objects
this.total_pages = response.data.total_pages
this.loaderAbandon = false
})
mounted(){
this.loaderAbandon = true
api.getWagonsThrow(this.filter_abadon)
.then((response) => {
while(this.filter_abadon.page_number != null){
this.throwWagons.push()
this.filter_abadon.page_number ++
}
this.amount = response.data.amount
this.total_objects = response.data.total_objects
this.total_pages = response.data.total_pages
})
То есть по мимо объектов с нужными ключами добавились еще отдельно вагон, хэш и т.д
их как-то можно не включать в ответ?