Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-echart instance doesn't have off function #788

Closed
1 task done
tustzdm opened this issue May 20, 2024 · 5 comments
Closed
1 task done

vue-echart instance doesn't have off function #788

tustzdm opened this issue May 20, 2024 · 5 comments

Comments

@tustzdm
Copy link

tustzdm commented May 20, 2024

请确认

  • 我可以确认这个问题无法在 ECharts 项目本身中复现。

您是如何将 Vue-ECharts 引入项目的?

通过 ES 模块 import

版本信息

6.6.9

问题详情

通过chart实例无法获取到off方法,导致事件无法解绑

问题复现

/

@Justineo
Copy link
Member

目前事件都是以声明式的方式绑定的(v-on),所以目前没有提供 on / off 方法。你的实际场景是什么?

@tustzdm
Copy link
Author

tustzdm commented May 20, 2024

目前事件都是以声明式的方式绑定的(v-on),所以目前没有提供 on / off 方法。你的实际场景是什么?

事件绑定了方法fn,那个方法fn.bind(this),this是一个很大的对象。组件销毁时,事件没法off掉,导致内存泄漏。
我倒是找到了ref.value.chart.off方法,但是好像也没有完全解绑掉事件,dispose里面也不会解绑事件吗?

@Justineo
Copy link
Member

组件销毁时 ECharts 实例和 Vue 实例都销毁了,你有可以复现问题的代码么?并且确认一下,这个问题仅在 vue-echarts 中出现而仅使用 ECharts 本身无法复现么?

@Justineo
Copy link
Member

Justineo commented May 28, 2024

如果是 ECharts 本身的问题,我们就不在这个项目中处理了。如果有疑问,可以在确认原生 ECharts 中没有此问题后,创建一个新 issue 并给出问题复现。

@tustzdm
Copy link
Author

tustzdm commented Jun 25, 2024

如果是 ECharts 本身的问题,我们就不在这个项目中处理了。如果有疑问,可以在确认原生 ECharts 中没有此问题后,创建一个新 issue 并给出问题复现。

不是方法没有off的问题。应该是vue和echart还有pinia组合的问题。将传给图表的ref数据转为普通数据后问题解决,升级Vue3.3至3.4也可以解决😂。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants