文档
- https://echarts.apache.org/zh/api.html#echartsInstance.on
- https://echarts.apache.org/zh/api.html#echartsInstance.off
代码示例
export default {
mounted() {
this.echart = Echarts.init(document.getElementById(this.echartId))
// 绑定点击事件
this.echart.on('click', this.handleEChartsClick)
// 销毁
this.$once('hook:beforeDestroy', () => {
this.echart.off('click', this.handleEChartsClick)
})
}
}