Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

261
Vistas
create an array of objects in the computed method vuejs?

I already appreciate your advice and answers, this time I go to you for the next problem I pass context, I want to create a dynamic table with quasar and vueJS this table will change according to a select field I have managed to bring the columns of the Selected tables, what I can't do is paint them in the view, since for this I must generate the following structure to be able to paint the table:

 columns: [
         {
           name: 'id', align: 'center', label: 'id', field: 'id'
         },
         {
           name: 'name', align: 'center', label: 'name', field: 'name'
         },
         {
           name: 'age', align: 'center', label: 'age', field: 'age'
         }
       ]
     }

I want to form the structure above from an array that comes to me from the database (the columns of the table), what I receive is the following:

const columnsTable = [
   "id",
   "name",
   "age"
];

I am trying as follows in my computed method: My computed method to generate the array of objects The result of this is not what was expected since in each key of my object the entire array is entered in this way. colums in the image The variable colums is where I want to generate the array of objects described at the beginning of the question. I appreciate your answers and opinions, anything would help me a lot, thank you very much.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Maybe something like following snippet:

const columnsTable = [
   "id",
   "name",
   "age"
];
const res = []
columnsTable.forEach(c => {
  res.push({name: c, align: 'center', label: c, field: c})
})
console.log(res)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda