echarts-gl
echarts-gl copied to clipboard
react项目里引用后报错TypeError: Cannot read property 'util' of undefined
D:/project/node_modules/echarts-gl/dist/echarts-gl.js:195
192 |
193 |
194 |
> 195 | __WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts___default.a.util.extend(__WEBPACK_IMPORTED_MODULE_6_claygl_src_Node__["a" /* default */].prototype, __WEBPACK_IMPORTED_MODULE_38__animatableMixin__["a" /* default */]);
196 |
197 | __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_39_claygl_src_shader_source_util_glsl_js__["a" /* default */]);
198 | __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_40_claygl_src_shader_source_prez_glsl_js__["a" /* default */]);
引用源码
import React, {useEffect, useState} from "react"
import * as echarts from 'echarts'
import 'echarts-gl'
interface Props {
option: any
}
const Echarts: React.FC<Props> = (props) => {
const [option, setOption] = useState(props.option)
useEffect(() => {
setOption(props.option)
})
return (
<>
<div ref={el => {
if(el){
const myChart = echarts.init(el)
myChart.setOption(option)
}
}} style ={{width:"100%",height:"100%"}}/>
</>
)
}
export default Echarts
I encountered the error message and my solution is to downgrade echarts-gl to 1.1.0, which works out.
i too am facing the same bug with version 5 of echarts.min.js is there a quick solution to this ?
even the version 1.1.0 of echarts-gl does not work with version 5 of echarts
应该是[email protected]和echarts-gl的兼容问题,希望尽快修复
fixed in [email protected]
不仅是echarts-GL,水球图也报错
cnpm install [email protected] --save Version 5.0 bug