Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

73
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda