Answer the question
In order to leave comments, you need to log in
When clicking on an image, how to get the object of this image in the vue method?
<img v-on:click="chooseImg" class="img_own" style="width:150px; height:150px; border:1px solid silver">
chooseImg:function(e){
console.log(e);
}
Answer the question
In order to leave comments, you need to log in
"Image object" - in the sense, a DOM element? Well, you can:
@click="onClick"
methods: {
onClick(e) {
console.log(e.target);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question