vue echarts 打包报错 TypeError: Cannot set properties of undefined (setting ‘colorStops‘)

echarts yekong 512℃

vue echarts 调试的时候正常运行,打包后却无法正常显示报错了。

TypeError: Cannot set properties of undefined (setting ‘colorStops‘)

问题代码:

areaColor: echarts.graphic.LinearGradient(0, 0, 0, 1, [
  {
    offset: 0,
    color: '#24e2f0',
  },
  {
    offset: 1,
    color: '#015090',
  },
]),

解决办法

在渐变色前面添加new 重新打包就可以了。

areaColor: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  {
    offset: 0,
    color: '#24e2f0',
  },
  {
    offset: 1,
    color: '#015090',
  },
]),
喜欢 (0)