Whenever I click on the image, I aim to apply a particular class to it. Here is how I am currently trying to accomplish this:
<div class="thumbnail">
<img
:image_id="image.id"
:src="'/storage/images/'+image.name"
@click="select(image)"
:class="{
'selected': image.selected
}"
/>
</div>
select(image) {
for (let i = 0; i < this.imageData.length; i++) {
if(image.id == this.imageData[i].id) {
this.imageData[i].selected = true
}
}
}
The issue I am facing is that upon clicking, the method is not being triggered. To confirm this, I added console.log()
in the select()
method.
I would appreciate any suggestions or solutions to address this problem.