[Vuejs]-How to get the index of v-for in a function in vue js html?

0👍

First of all you will have to pass index to deleteSubmit, as Vamsi Krishna commented

 <a @click="deleteSubmit(arrest, index)" target="_blank">Delete Arestee</a></button>

Then you can bind the index in the callback:

deleteSubmit: function(arrest, index) {
  ...
  success: function(index, arrest) {
    if (arrest.status){
      alert("Success")
      arrest.splice(index, 1);
    } else {
      alert("Failed")
    }
  }.bind(null, index)
  ...
}

Leave a comment