Answer the question
In order to leave comments, you need to log in
How to make reactivity when deleting an entry in vue.js using my example?
I display images in a loop
<tr v-for="img in image">
<td>{{ img }}</td>
<td> <button v-on:click="removeImage(id)">Remove image</button></td>
</tr>
removeImage(id) {
axios.post('/img/delete/' + id).then(function(){
console.log('SUCCESS!!');
})
.catch(function(){
console.log('FAILURE!!');
});
},
Answer the question
In order to leave comments, you need to log in
<tr v-for="(img, n) in image">
<td>{{ img }}</td>
<td> <button v-on:click="removeImage(n)">Remove image</button></td>
</tr>
...
.then(response => {
this.image.splice(n, 1);
})
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question