I am a beginner in Vue and I want to create a project that uses Chart.js. I am using Vuex and am having a trouble to generate the data into the component.
<script>
import{Line} from 'vue-chartjs';
import {mapGetters,mapActions} from 'vuex';
export default {
extends:Line,
data: () => ({
chartdata: {
labels: ['January', 'February'],
datasets: [
{
label: 'Data One',
backgroundColor: '#f87979',
data: this.currentDeath
}
]
},
options: {
responsive: true,
maintainAspectRatio: false
}
}),
methods:{
...mapActions(["fetchData"]),
},
computed:{
...mapGetters(["currentDeath"])
},
created(){
this.fetchData()
},
mounted(){
const dates = this.
this.renderChart(this.chartData,this.options)
}
}
</script>
<style scoped>
</style>
It says on localhost that "currentDeath is undefined". However if I were to print it on screen it is populated with an array of data. Anyone knows how I can access its data?