目录
报错:export 'default' (imported as 'echarts') was not found in 'echarts'。
报错:There is a chart instance already initialized on the dom。
图表不展示
一定要设置高宽。
<div id="chart style="width:500px; height:500px" ></div>
报错:export 'default' (imported as 'echarts') was not found in 'echarts'。
当前版本
解决方案
npm install echarts@4.9.0
报错:There is a chart instance already initialized on the dom。
dom上已经初始化了一个实例,并且如果你图表中定义了点击方法,多次覆盖之后,点击方法会触发多次。更新页面重复加载这个图表实例时就会出现这类警告。
var mychart
if (mychart != null && myChart != "" && myChart != undefined) {
myChart.dispose()
}
myChart = echarts.init(document.getElementById('container'));
let myChart = this.$echarts.getInstanceByDom(this.$refs[this.chart.type]);
if (myChart == null) {
myChart = this.$echarts.init(this.$refs[this.chart.type]);
}
myChart.setOption(option);