[Vuejs]-Vue Chart.js – Can't use the return data for chart data set

1πŸ‘

βœ…

I don’t really understand the patterns in your code, like where this.promise is initialised.

Why don’t you try something that’s a bit easier to understand.

methods: {
    async getApiChartData() {
        let responseData = (await axios.get(api_url)).data.data;
        return [responseData[0], responseData[1], responseData[2]];
    }
}

Then in mounted

async mounted() {
    let datapresent = await this.getApiChartData();
    //rest of your code
}
πŸ‘€Shoejep

Leave a comment