Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

71
Views
Manejar múltiples entradas en Vue 3

Estoy construyendo una aplicación de administración de granjas con Laravel y Vue usando Inertia

tengo las siguientes tablas

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

En el componente Produtcs/Create.vue estoy generando múltiples entradas html usando la directiva v-for así

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

El objetivo principal aquí es almacenar el valor de la ratio para cada nutriente generado en la tabla nutrient_product

Traté de almacenar el valor de la ration para cada entrada en una matriz pero negativo. No estoy seguro de cómo manejar esto

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Me alegro de poder ayudarte.

Por favor intente con el siguiente código:

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

Obtendrá fácilmente todos los valores de entrada en una matriz como la siguiente

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

¡Gracias!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!