How to set the a tag in Vue for download?

1. How can I use the a tag in Vue to download a file?
I gave a link directly in the a tag, and then added the attribute of download
Export
this operation can only jump to the path of the picture. This is the first time I have encountered this situation.

clipboard.png

Mar.02,2021
The

download option seems to apply only to the same origin, and resources can be converted to base64 format if necessary.


<el-button type="success" class="to_lead" @click.native="exportData()">
   <span class="glyphicon glyphicon-arrow-up"></span> 
</el-button>

using the most original way of writing, register the click event directly on button, and give the link below to get it done

exportData() {
   location.href = "https://img.codeshelper.com/upload/img/2021/03/02/lmau1sur1ru2080.png";
}
The href attribute of

a tag is empty, and the test is valid

.
Menu