[Vuejs]-How to change prepend-icon in a Vuejs v-for loop on click?

1👍

First of all, your save method is not working properly. In rendering data of v-for you need a flag for that save. so save=false will be there after that,

:prepend-icon="isAnswer[id].saved?'mdi-check-box-outline':'mdi-checkbox-blank-outline'"

and method will be

saveAns(index){
    this.isAnswer[index].save = !this.isAnswer[index].save
    console.log(index)
},

Leave a comment