vue使用 echarts添加点击事件的坑

it2026-01-29  3

事件外面定义 

let that = this

事件里面定义使用that即可解决

示例

let that = this this.yxsjLeftChart.on('click', function(param) { that.$layer.open({ type: 2, title: '看板', shadeClose: false, shade: 0.5, area: ['1720px', '880px'], scrollbar: false, content: { content: jzgyGC, //传递的组件对象 data:{}//props }, }) })

如果没有在点击事件外层定义this,function里面this会是undefined

最新回复(0)