[Vuejs]-How to know the iteration in v-for

2πŸ‘

βœ…

if I understand you correct you want to check your first radio button from your v-for.

You have two options to achieve that:

First option
You can set selectedChoice to your first choice like this:

data() {
  return {
    options: ['yourChoice1', 'yourChoice2'] //you have to set your array in here
    selectedChoice: 'yourChoice1',
  }
}

Second option
You set your data prop to the first item in your array – this is able because you’re using v-model – you do it like this:

this.selectedChoice = this.yourChoice[0]

Hopefully this helps you out – please let me know!

Leave a comment