[Vuejs]-Vue keep line chart updated using props

0👍

It looks like you’re updating subproperties of each of the watched objects, but Vue 2 watchers don’t monitor subproperty changes by default.

One solution is to use the deep flag for the watchers:

// ChartComponent.vue
export default {
  watch: {
    aqiLineChartData: {
      immediate: true,
      deep: true,
      handler() {/*...*/}
    }
  }
}

// LineChart.js
export default {
  watch: {
    chartData: {
      deep: true,
      handler() {/*...*/},
    }
  }
}   

Leave a comment