My first attempt at using PapaParse is running into some issues. I am successfully parsing a remote CSV file and storing the data, as confirmed by console.log. However, when I try to output it with a v-for loop, nothing seems to be working.
To achieve this, I am utilizing the vue-papa-parse library.
Take a look at my code below:
<template>
<div class="uk-section">
<div class="uk-container">
<ul v-if="cases">
<li v-for="(item, index) in cases" :key="index">{{item.date}} / {{item.World}}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
data() {
return {
cases: [],
}
},
methods: {
totalCases(){
let url = "https://covid.ourworldindata.org/data/ecdc/total_cases.csv";
this.$papa.parse(url, {
header: true,
download: true,
dynamicTyping: true,
complete: function(results) {
this.cases = results.data;
console.log(this.cases);
}
})
}
},
mounted() {
this.totalCases();
}
}
</script>
https://i.stack.imgur.com/pmErZ.png
I seem to be at a roadblock without any errors to guide me. If you have any insights or suggestions on what might be going wrong, I would greatly appreciate your help. Thank you.