|
@@ -3,24 +3,17 @@ export default {
|
|
|
mounted() {
|
|
|
this.chart = echarts.init(this.$el);
|
|
|
this.chart.setOption(this.options);
|
|
|
- this.chart.resize();
|
|
|
+ new ResizeObserver(this.chart.resize).observe(this.$el);
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- this.destroyChart();
|
|
|
+ this.chart.dispose();
|
|
|
},
|
|
|
beforeUnmount() {
|
|
|
- this.destroyChart();
|
|
|
+ this.chart.dispose();
|
|
|
},
|
|
|
methods: {
|
|
|
update_chart() {
|
|
|
- if (this.chart) {
|
|
|
- this.chart.setOption(this.options);
|
|
|
- }
|
|
|
- },
|
|
|
- destroyChart() {
|
|
|
- if (this.chart) {
|
|
|
- this.chart.dispose();
|
|
|
- }
|
|
|
+ this.chart.setOption(this.options);
|
|
|
},
|
|
|
},
|
|
|
props: {
|