[Vuejs]-Handle multiple inputs in Vue 3

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!

Leave a comment