简体   繁体   中英

How to map Json response in QUASAR

I need to take all persons names, using quasar and vue3.

I need to take all persons data, but I only can take the first object fields like row.persons[0].name .

Quasar column data:

  {
    name: "personName",
    label: "Name",
    field: rows => rows.persons.name, //here that I can't return both person content
    sortable: true,
    align: "center",
  },

Json response

{
  "id": 4291,
  "persons": [
    {
      "id": 12485,
      "name": "",
      "email": "",
    },
    {
      "id": 21898,
      "name": "",
      "email": "",
      
    }
  ]
}

you could use map on rows.persons array

for eg

rows.persons.map(person=>person.name)

will return array containing only the names

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM