After I loop through the data in the front-end with Vue I am able to display the images but I do not know how to download it. I want to be able to click on either the image or a button in other to download the image.
<ul>
<li v-for="data in mydata" :key="data.id">
<img :src= "data.url" alt="image" class="img-thumbnail"/>
</li>
</ul>
You can use the download
attribute of <a>
element:
<li v-for="data in mydata" :key="data.id">
<a :href="data.url" download>
<img :src="data.url" alt="image" class="img-thumbnail"/>
</a>
</li>
But note that IE and Safari don't support download
https://caniuse.com/#feat=download
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With