apache echarts数据点重影或 Cannot read properties of undefined (reading 'type')错误问题

环境

vue3
apache echarts 5.6.0

导致的结果

image
image

解决方法

请检查你的echart的实例(也就是echarts.init方法响应的实例)对象是否是普通变量。
如果使用refreactive包裹,请移除或更换为shallowRef(或shallowXXX)这类的函数定义即可。
因为echarts对象深层响应式不是所支持的使用方式。

如,错误的写法:

const chart = ref(null);
// 或
const chart = reactive({
  one: null
});

正确的写法:

let chart = null;
// 或
const chart = shallowRef(null);

参考

[Bug] ECharts.resize() ERROR! Cannot read properties of undefined (reading 'type')

posted @ 2025-12-17 15:52  星小梦  阅读(5)  评论(0)    收藏  举报