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

74
Vistas
Handle multiple inputs in Vue 3

I'm building a farm management application with Laravel and Vue using Inertia

I have the following tables

products (id, name, ...)
nutrients (id, name, ...)
nutrient_product (nutrient_id, product_id, ratio, ...)

In the Produtcs/Create.vue component I'm generating multiple html inputs using v-for directive like so

<div v-for="nutrient in nutrients" :key="nutrient.id">
     <Input v-model="ratio" type="text" />
</div>

The main purpose here is to store the value of ratio for each generated nutrient in the nutrient_product table

I tried to store the ration value for each input in an array but negative. Not sure how to handle this

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

0

I'm glad I can help you.

Please try with the below code:

<div v-for="nutrient in nutrients" :key="nutrient.id">
     <Input v-model="ratio[nutrient.id]" type="text" />
</div>

You will get easily all inputs values in array like below

ratio[{
   1: 'Lorem ipsum',
   2: 'Test Value',
   nutrientID: nutrientValue 
}]

Thanks!

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