barPolar.js:63 Uncaught TypeError: Cannot read properties of undefined (reading 'type')

util.js:406 Uncaught Error: `resize` should not be called during main process.

vue版本3.0 echarts5.2

窗口发生变化调用echarts控制台会报上面2个错误

vue3使用proxy的方式监听响应式,会被在vue内部转换成响应式对象,从而在resize 的时候获取不到

coordSys.type

参考官方:

你可以有选择地退出默认的深度响应式/只读转换模式,并将原始的,未被代理的对象嵌入状态图中。它们可以根据情况灵活运用:

  • 有些值不应该是响应式的,例如复杂的第三方类实例或 Vue 组件对象。(第三方实例)
  • 当渲染具有不可变数据源的大列表时,跳过 proxy 转换可以提高性能。

所以在实例化echart时,将其指定为非响应式的即可。

let dataEcharts = markRaw ({
      myCharts: null,
    })

dataEcharts.myCharts = $echarts.init(dataList.echarts);

Logo

前往低代码交流专区

更多推荐