title: How to download a locally stored file in VueJS
body: <p>I have an upload system and I am trying to supply a sample template for users. I have a template stored locally in a subfolder in assets, I would like to access that in my VueJS component and display a link to it on the page. These are the applicaple parts of the file structure:</p>
  <pre><code>├──app
  │  └──Components
  │     └──Uploader.vue
  └──assets
     └──files
        └──Template_Upload.csv
  </code></pre>
  <p>In Uploader.vue I have this line:</p>
  <pre><code>&lt;a v-bind:href=&quot;item.loc&quot; download&gt;{{item.title}}&lt;/a&gt;
  </code></pre>
  <p>And in the export I have this line</p>
  <pre><code>data() {
    return {
      item: {title: 'Upload Template', loc: require('../../assets/files/Template_Upload.csv')}
  }
  </code></pre>
  <p>This method works if I have an image. Upon clicking on the link, it downloads the image. However, if I use a .csv or a .xlsx file, errors are thrown upon opening the page. I've tried using</p>
  <pre><code>import fileTemplate from &quot;../../assets/files/FileTemplate.csv&quot;;
  </code></pre>
  <p>As well, and using <em>fileTemplate</em> as the <em>loc</em> property. This also works if I use a picture. But I'm not able to bring in a document. Is this a limitation I can't get past or is there a different method I can try?</p>
  <p>I've also gone into Visual Studio (in other words, the .csproj file), and set the Template_Upload.csv <em>Build Action</em> setting is set to &quot;Content&quot; and the <em>Copy to Ouput Directory</em> setting is set to &quot;Copy Always&quot;.</p>
  <p>These are the resources I have primarily used thus far:</p>
  <blockquote>
  <p><a href="https://stackoverflow.com/questions/45116796/how-to-import-and-use-image-in-a-vue-single-file-component">How to import and use image in a Vue single file component?</a></p>
  <p><a href="https://stackoverflow.com/questions/145752/what-are-the-various-build-action-settings-in-visual-studio-project-properties">What are the various &quot;Build action&quot; settings in Visual Studio project properties and what do they do?</a></p>
  </blockquote>