I'm trying to add a button or a tag to allow the user to download a .docx file that I have saved in the project. I've done this is vanilla JS and it works fine to just have an <a href="path" download>. But this isn't working in Vue.
I've also tried to do this in JavaScript instead where the user clicks a button which runs the following function:
downloadResume() {
const link = document.createElement("a");
link.href = "../#/assets/Resume.docx";
link.setAttribute("download", "Resume.docx");
document.body.appendChild(link);
link.click();
}
For the link.href line, I originally did not add the # extension on it, but it would always say there's no file when it downloads. The # is part of the domain URL. It "downloads" now with it but when I try to open the file, it throws some errors saying that it's unable to read the file.
I haven't been able to find anything on this particular scenario. Everything I find on the internet is for downloading something from an external URL using Axios, converting to a blob, then downloading.