Fixed #1463 - When Chart component is updated, it throws an exception
parent
32d23d01e9
commit
628325522c
|
@ -45,6 +45,11 @@ export default {
|
|||
methods: {
|
||||
initChart() {
|
||||
import('chart.js/auto').then((module) => {
|
||||
if (this.chart) {
|
||||
this.chart.destroy();
|
||||
this.chart = null;
|
||||
}
|
||||
|
||||
if (module && module.default) {
|
||||
this.chart = new module.default(this.$refs.canvas, {
|
||||
type: this.type,
|
||||
|
@ -66,10 +71,7 @@ export default {
|
|||
}
|
||||
},
|
||||
reinit() {
|
||||
if (this.chart) {
|
||||
this.chart.destroy();
|
||||
this.initChart();
|
||||
}
|
||||
this.initChart();
|
||||
},
|
||||
onCanvasClick(event) {
|
||||
if (this.chart) {
|
||||
|
|
Loading…
Reference in New Issue