From 3e423fd7aed57b4a19b7aefb85cd0c99de77b841 Mon Sep 17 00:00:00 2001 From: Zhang Yijiang Date: Tue, 4 Jul 2017 09:58:52 +0800 Subject: [PATCH] Fix beforeDestory when renderChart was not called --- src/BaseCharts/Bar.js | 4 +++- src/BaseCharts/Bubble.js | 4 +++- src/BaseCharts/Doughnut.js | 4 +++- src/BaseCharts/HorizontalBar.js | 4 +++- src/BaseCharts/Line.js | 4 +++- src/BaseCharts/Pie.js | 4 +++- src/BaseCharts/PolarArea.js | 4 +++- src/BaseCharts/Radar.js | 4 +++- src/BaseCharts/Scatter.js | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/BaseCharts/Bar.js b/src/BaseCharts/Bar.js index 7ccab317..db91474e 100644 --- a/src/BaseCharts/Bar.js +++ b/src/BaseCharts/Bar.js @@ -79,6 +79,8 @@ export default Vue.extend({ } }, beforeDestroy () { - this._chart.destroy() + if (this._chart) { + this._chart.destroy() + } } }) diff --git a/src/BaseCharts/Bubble.js b/src/BaseCharts/Bubble.js index d7f096d6..50279ba7 100644 --- a/src/BaseCharts/Bubble.js +++ b/src/BaseCharts/Bubble.js @@ -80,6 +80,8 @@ export default Vue.extend({ } }, beforeDestroy () { - this._chart.destroy() + if (this._chart) { + this._chart.destroy() + } } }) diff --git a/src/BaseCharts/Doughnut.js b/src/BaseCharts/Doughnut.js index 0dd3fd04..0df50c9d 100644 --- a/src/BaseCharts/Doughnut.js +++ b/src/BaseCharts/Doughnut.js @@ -63,6 +63,8 @@ export default Vue.extend({ } }, beforeDestroy () { - this._chart.destroy() + if (this._chart) { + this._chart.destroy() + } } }) diff --git a/src/BaseCharts/HorizontalBar.js b/src/BaseCharts/HorizontalBar.js index 9a860e50..422437bc 100644 --- a/src/BaseCharts/HorizontalBar.js +++ b/src/BaseCharts/HorizontalBar.js @@ -79,6 +79,8 @@ export default Vue.extend({ } }, beforeDestroy () { - this._chart.destroy() + if (this._chart) { + this._chart.destroy() + } } }) diff --git a/src/BaseCharts/Line.js b/src/BaseCharts/Line.js index fd922b3f..cc54fb39 100644 --- a/src/BaseCharts/Line.js +++ b/src/BaseCharts/Line.js @@ -78,6 +78,8 @@ export default Vue.extend({ } }, beforeDestroy () { - this._chart.destroy() + if (this._chart) { + this._chart.destroy() + } } }) diff --git a/src/BaseCharts/Pie.js b/src/BaseCharts/Pie.js index ad07eed0..2d6b2b33 100644 --- a/src/BaseCharts/Pie.js +++ b/src/BaseCharts/Pie.js @@ -63,6 +63,8 @@ export default Vue.extend({ } }, beforeDestroy () { - this._chart.destroy() + if (this._chart) { + this._chart.destroy() + } } }) diff --git a/src/BaseCharts/PolarArea.js b/src/BaseCharts/PolarArea.js index 11b580a8..cac465dc 100644 --- a/src/BaseCharts/PolarArea.js +++ b/src/BaseCharts/PolarArea.js @@ -63,6 +63,8 @@ export default Vue.extend({ } }, beforeDestroy () { - this._chart.destroy() + if (this._chart) { + this._chart.destroy() + } } }) diff --git a/src/BaseCharts/Radar.js b/src/BaseCharts/Radar.js index 2e6fa39f..eaddf7d6 100644 --- a/src/BaseCharts/Radar.js +++ b/src/BaseCharts/Radar.js @@ -63,6 +63,8 @@ export default Vue.extend({ } }, beforeDestroy () { - this._chart.destroy() + if (this._chart) { + this._chart.destroy() + } } }) diff --git a/src/BaseCharts/Scatter.js b/src/BaseCharts/Scatter.js index ef6d0d38..d003d034 100644 --- a/src/BaseCharts/Scatter.js +++ b/src/BaseCharts/Scatter.js @@ -64,6 +64,8 @@ export default Vue.extend({ } }, beforeDestroy () { - this._chart.destroy() + if (this._chart) { + this._chart.destroy() + } } })