echarts-gl icon indicating copy to clipboard operation
echarts-gl copied to clipboard

react项目里引用后报错TypeError: Cannot read property 'util' of undefined

Open caocong1 opened this issue 4 years ago • 7 comments

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

caocong1 avatar Dec 08 '20 04:12 caocong1

I encountered the error message and my solution is to downgrade echarts-gl to 1.1.0, which works out.

jnzs1836 avatar Dec 09 '20 11:12 jnzs1836

i too am facing the same bug with version 5 of echarts.min.js is there a quick solution to this ?

anoosurf avatar Dec 20 '20 06:12 anoosurf

even the version 1.1.0 of echarts-gl does not work with version 5 of echarts

anoosurf avatar Dec 20 '20 06:12 anoosurf

应该是[email protected]和echarts-gl的兼容问题,希望尽快修复

Deeeeeeepth avatar Dec 22 '20 04:12 Deeeeeeepth

fixed in [email protected]

pissang avatar Dec 22 '20 07:12 pissang

不仅是echarts-GL,水球图也报错

kawayineiyo avatar Dec 27 '20 01:12 kawayineiyo

cnpm install [email protected] --save Version 5.0 bug

sunqkd avatar Jan 12 '21 03:01 sunqkd