<form method="post" action="#" enctype="multipart/form-data">
<div class="row">
<div class="col-md-12">
<div class="image-upload" v-for="(item, index) in uploadVal" :key="item._id">
<label class="btn btn-sm btn-success">
<a-icon type="upload" />Upload
<input
type="file"
ref="file"
accept="image/*"
@change="handleClickUpload"
style="display: none;"
/>
</label>
<div class="show-img">
<img :src="getImageURL(item.url)" />
</div>
</div>
</div>
</div>
</form>
In methods:
methods: {
handleClickUpload(e) {
console.log(e.target.files);
},
}
I am doing upload image in vuejs. And I want to get the index
value of the v-for loop under the handleClickUpload
of the methods. Is there any way to get index
in handleClickUpload
? Please give me ideas.Thanks