bug描述
echarts添加endLabel属性之后
调用this.myChart.setOption(this.option)方法
找不到setOption
Error: setOption should not be called during main process.
at assert (util.js:455:15)
at ECharts.setOption (echarts.js:443:7)
at VueComponent.setData (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/Chart/Common/HotChart.vue?vue&type=script&lang=js:320:22)
at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/product/temperature-humidity/index.vue?vue&type=script&lang=js:264:33)
那我settimeout 1000ms 结果还是找不到
代码
this.option.series:[
{
name: 'line',
type: 'line',
showSymbol: false,
lineStyle: {
color: 'black' // 设置折线颜色为黑色
},
endLabel: {
show: true, // 是否显示终点标签
formatter: function(params) {
return '0°C'
},
position: 'top'
}
},
]
上官网看
那我看我的echarts 版本是 5.1.2 啊
解决方法
npm 看了最新版本是5.5.0
npm install echarts@5.5.0
再跑项目 发现bug没了
然后我再npm install echarts@5.1.2
?
报错没了,图也正常显示了