You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Quasar 2及vue3-apexcharts后遇Cannot read properties of undefined(reading 'events')错误

解决Quasar 2 + vue3-apexcharts初始化时的TypeError: Cannot read properties of undefined (reading 'events')错误

问题场景

将项目升级至Quasar 2,同时将图表依赖从"vue-apexcharts": "^1.5.1"更新为"vue3-apexcharts": "^1.6.0",适配原有图表代码时触发错误。

报错信息

vue3-apexcharts.js:85 Uncaught (in promise) TypeError:
Cannot read properties of undefined (reading 'events') at r (vue3-apexcharts.js:85:30)

排查过程

尝试使用官方仓库中的Donut示例代码测试,仍出现相同错误,确认问题源于依赖初始化时的配置缺失,而非业务代码逻辑差异。

解决方案

在图表的chartOptions配置对象中,显式添加chart: { events: {} }配置项即可修复该错误:

const chartOptions = {
  chart: {
    events: {} // 显式声明空的events对象
  },
  // 其他图表配置项...
}

内容的提问来源于stack exchange,提问作者jordan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 01:03:10