- 项目中需要用到echarts图表库,但是在setOption时,程序报错,图表不能正常加载。
- 报错提示如下:
found in
---> <Workbench> at E:Worktrunk_mallsrccomponentsmodulesworkbenchworkbench.vue
<Index> at E:\Work\trunk_mall\src\index.vue
<Root>
TypeError: ComponentClass is not a constructor
at Echarts._render (echarts.js:710)
at Echarts._setOption (echarts.js:988)
at Echarts.setOption (echarts.js:939)
at VueComponent.mounted (workbench.vue:111)
at callHook (vue.esm.js:2665)
at Object.insert (vue.esm.js:3526)
at invokeInsertHook (vue.esm.js:5469)
at VueComponent.patch [as __patch__] (vue.esm.js:5639)
at VueComponent.Vue._update (vue.esm.js:2424)
at VueComponent.updateComponent (vue.esm.js:2538)
- 界面显示效果,只显示了lengend,没有显示图表。
问题已解决,按照解决方案来看确实是echarts包版本的问题。

之前安装的包版本是2.8,现在直接更新成最新版本就能正常使用了。
我这边项目里面使用echarts的方式如下: