[Vuejs]-Child component not receiving props from parent after data is updated in parent

0👍

BarChart.vue

<template>
  <div class="chart-container">
    <canvas id="barChart" ref="barChart" />
  </div>
</template>

<script>
import Chart from "chart.js";

export default {
  props: {
    labels: Array,
    colors: Array,
    data: Array,
    label: ""
  },
  mounted() {
    this.displayChart();
  },
  watch: {
    'data': 'displayChart'
  },
  methods: {
    displayChart() {
      console.log(this.data);
    }
  }
}

Try this :))

Leave a comment