0

I've been trying to send values to a function through @click method but only the first value is passing and the other values are not passing.

<tr v-for="(m, i) in list.accounts" :key="i">
   <td class="border-top-0">
        <div class="custom-control custom-radio">
          <input
            type="radio"
            class="custom-control-input"
            name="accept_revoke"
            id="accept"
            value="1"
            :checked="list.acceptRevoke[m.id] == 1"
            @change="dialogConfirm(m.id)"
          />

          <label class="custom-control-label" for="accept">Yes ---{{m.id}}</label>
        </div>
        <div class="custom-control custom-radio">
          <input
            type="radio"
            class="custom-control-input"
            name="accept_revoke"
            id="revoke"
            value="0"
            :checked="list.acceptRevoke[m.id] == 0"
            @change="dialogConfirm(m.id)"
          />
          <label class="custom-control-label" for="revoke">No---{{m.id}}</label>
        </div>
      </td>
  </tr>

and in the above part where m.id changes for each iteration in ui but while passing the value to the dialogConfirm function it is always taking the value of list.accounts[0].id. i.e the first iteration value. i also checked the value receiving at the function dialogConfirm through console.log

dialogConfirm(id) {
  console.log("id",id)
}

Could someone help me on this, your help will be much appreciated, Thanks in adv.!!

Ravn
  • 3
  • 2
  • Indices make terrible keys, use `:key="m.id"` instead – Phil Dec 07 '21 at 03:13
  • value not passing to the function is the main issue here dude and also tried your suggestion not working though – Ravn Dec 07 '21 at 04:34
  • Do the entries in `list.accounts` all have `id` properties? – Phil Dec 07 '21 at 05:01
  • Found the issue that i've not used different id for each iteration in radio button, added different id for radio button then the issue solved. – Ravn Dec 07 '21 at 11:04

0 Answers0