How to create a button that can download a (.pdf or .word) file with vue (webpack template)

hey, guys, i haven’t been able to find an answer for my question so i decided to post my own threat.
in the past was very simple to make a button that could download files from the website.
how can i make this happen in vue? thanks.

THE OLD WAY
<a class=“btn-download” href="[ website-folder/name.file ]> Download

I am not sure if I understand your problem correctly. Do you need help with how to do a correct <a>-tag in HTML?

<a href="link-to.pdf" target="_blank">Download</a>

1 Like

no sir, my question is how to code a download button in vue? the example above is to show how simple it was in plain html css.

And why would you not be able to use that in Vue? :slight_smile:

it doesnt work…do i need to pass some data first or something?

Take a look at the docs for static asset handling. You will still be doing it “the old way” but you just need to handle where the link goes to - or in other words, how to link to your specific static asset.

thank you sir, ill be working on it!

This mite help.

This NOT suppose to help, only if you are developing browser extension.