0👍
There are two issues with your chartData
in the child component:
- it is not updated when data changes
- chart-js requires you to rebuild both the
chartData
object and thechartData.datasets
array to detect changes and redraw the chart
You can fix both by turning your chartData
into a computed property:
computed: {
chartData(){
return {
labels: this.labels,
datasets: [
{
borderColor: "#f6b09e",
backgroundColor: "rgb(246, 176, 157)",
label: "crimes",
data: this.dataset,
},
],
}
}
}
Here is a simplified playground
- [Vuejs]-POST request triggers both THEN and CATCH
- [Vuejs]-Trying to compare a list of dates to current date, but it's just returning false
Source:stackexchange.com