vue项目 在echarts tooltip中添加点击事件


created () {
window.wordClick = this.myClick;// 把点击事件绑到window上
},
methods: {
  myClick(name){ // 事件具体操作
        console.log(name);
},
}
// tooltip中绑定的点击事件
tooltip: {
trigger: 'axis',
backgroundColor :'rgba(78,93,225,0.75)',
borderWidth:2,
borderColor :'rgba(78,93,225,0.75)',
axisPointer: {
type: 'cross',
label: {
backgroundColor :'rgba(78,93,225,0.75)',
borderWidth:1,
borderColor :'rgba(78,93,225,0.75)',
}
},
triggerOn: 'mousemove|click', //触发方式 移入或点击
enterable: true, // 鼠标可移入tooltip中 必须
formatter:(params)=> {
let data = params[0]
return data.name + ': ' + data.data + '<div style="cursor: pointer;color:red" onclick="wordClick(\''+data.data+'\')">查看相关内容</div>'
}
},


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM