Skip to content
Advertisement

Passing vuejs input value to multiple data

I want to send an input value to more than one data. I searched but couldn’t find it, how can I do it? How can I do without method?

<input type="text" v-model="money_transfer.amount"/>

money_transfer: {
   amount: '', 
   source_amount: '', 
   target_amount: '', 
},

Advertisement

Answer

You can use this syntax to pass input value to multiple variables:

<input
   :value="money_transfer.amount"
   @input="money_transfer.amount = money_transfer.source_amount = money_transfer.target_amount = $event.target.value"
>
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement