Clicking the radio button inside a v-for loop changes at a time state to all of the radio button vue3

27 views Asked by At

Clicking the radio button inside a v-for loop changes at a time state to all of the radio button vue3. When I click the radio button , the all of the three radio buttons are checked at a time. How can I fix it, preferably not creating a single component for each radiobutton.

        <div class="answers">
          <div class="test2">
            <ErtFieldCheckbox
              v-for="answer in proposedAnswers"
              :key="answer.id"
              v-model="clientAnswer"
            />
          </div>
        </div>
        
        <script>
        let clientAnswer = ref('')
          const proposedAnswers = ref([
        {
          id: '1',
          text: 'good',
        },
        {
          id: '2',
          text: 'bad',
        },
        {
          id: '3',
          text: 'else',
        },
      ])
        <script>

0

There are 0 answers