Delving into the world of vue.js, I find myself pondering over how to incorporate a download link in my webpage for a CSV file stored locally.
In my component Template.vue, I have the following structure:
<a :href="item.loc" download> {{item.title}} </a>
My export section looks like this:
export default {
name: 'Template',
data () {
return {
item: {loc: require("../assets/example.csv")}
}
}
}
Unfortunately, my current setup does not seem to support CSV files. When attempting to execute the code with a CSV file, I encountered the following error message:
"./src/assets/example.csv Module parse failed: Unexpected token (1:14) You may need an appropriate loader to handle this file type."
On the other hand, downloading an image (png) seems to work just fine. How can I tackle this issue? Is there a way to integrate a loader or are there alternative solutions available?