1👍
For example you can use this function:
groupBy (list, keyValue) {
const map = new Map()
list.forEach((item) => {
const key = item[keyValue]
const collection = map.get(key)
if (!collection) {
map.set(key, [item])
} else {
collection.push(item)
}
})
return Array.from(map.values())
}
then just call it
const map = groupBy(this.problemitems, 'CustomerID')
You can use function in Vue methods, then don’t forget this
Source:stackexchange.com