echarts 在使用dataZoom时报错,Cannot read properties of undefined (reading 'type')

发布时间 2023-07-05 16:18:17作者: 奔跑的哈密瓜

今天我再vue中使用柱状图拖动时,一直报错Cannot read properties of undefined (reading 'type')。

原因如下,我使用了myChart 来接收数据,当myChart使用的是vue的ref或者reactive来命名的变量,如果这样子命名就会报上述错误。

     myChart = echarts.init(
        statistical
    );

应该使用let或者var定义myChart ,就不会出现错误了。