K
K
Konstantin Timosheno2020-05-19 07:44:11
Vue.js
Konstantin Timosheno, 2020-05-19 07:44:11

How to group data in Vue?

Hi everybody.
There is such a problem, I can not think in any way how to do it right.
json comes from the back

response

"serv": [
        {
            "id": 4,
            "name": "serv",
            "perfomance": 120,
            "production": 0,
            "production_doc": null,
            "laboratory": 0,
            "laboratory_doc": null,
            "scale": 0,
        },
        {
            "id": 5,
            "name": "serv",
            "perfomance": 120,
            "production": 0,
            "production_doc": null,
            "laboratory": 0,
            "laboratory_doc": null,
            "scale": 0,
        },
        {
            "id": 6,
            "name": "serv",
            "perfomance": 120,
            "production": 0,
            "production_doc": null,
            "laboratory": 0,
            "laboratory_doc": null,
            "scale": 0,
        },        
    ],
   "serv555": [
        {
            "id": 10,
            "name": "serv555",
            "rating": null,
            "checked": 0,
            "vip": 0,
           "perfomance": 120,
            "production": 0,
            "production_doc": null,
            "laboratory": 0,
            "laboratory_doc": null,
            "scale": 0,
        }
    ]


That is, it comes grouped by name.
The whole problem is to group the output and output in a loop so that you get one record with unique values. I tried with lodash, but unfortunately it didn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lugindev, 2020-05-19
@kastembay

If I understand you correctly, then yes.
But

with unique values
by what parameter unique?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question