echarts:解决There is a chart instance already initialized on the dom问题

 if ( this.chartInstance != null && this.chartInstance != "" && this.chartInstance != undefined ) {
               this.chartInstance.dispose();
           }
       this.chartInstance = this.$echarts.init(this.$refs.chart, 'light');
       this.chartInstance.setOption(this.option);

先判断一下echarts实例是否存在,如果存在,就先dispose,然后再init成新的实例。


版权声明:本文为lilycheng1986原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。