0👍
You did not provide your full code, so I don’t know how your Objects look like.
One possible solution could be grouping your items by date in a Vue Computed function.
const groupBy = key => array =>
array.reduce((objectsByKeyValue, obj) => {
const value = obj[key];
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
return objectsByKeyValue;
}, {});
const items = [
{ name: 'XY', date: '01.02.2019' },
{ name: 'DEF', date: '05.03.2019' },
{ name: 'ABC', date: '05.03.2019' },
{ name: 'FOO', date: '05.03.2019' }
];
const groupByDate = groupBy('date');
console.log(
JSON.stringify(groupByDate(items), null, 2)
);
Add this code to a computed Vue Function:
Vue computed documentation
- [Vuejs]-Why is the width card when accessed on Windows and Macbook Pro different?
- [Vuejs]-How to pass data from method inside component1 to component2
Source:stackexchange.com