echarts报错`setOption` should not be called during main process

echarts报错setOption should not be called during main process

问题描述

父组件传值给wordcloud组件渲染echarts,报错:setOption should not be called during main process.
原因是在渲染的时候,数据的先后顺序导致报错

解决办法

加延迟,等数据加载完毕后再渲染(延迟加在哪里都可以,只要先让数据从父组件传过来就好)

1
2
3
setTimeout(()=>{
draw()
},500)

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!