以上为效果图,参考链接:https://www.jianshu.com/p/cc93b3b72be6
1.tooltip中添加绑定事件
tooltip: { triggerOn: 'click', enterable: true, formatter: (parm) => { let data = parm.data return data.name + ': ' + data.value + '<div style="pointer-events: all;line-height: 24px; border-radius: 2px; background: #fff; color: #736AF2;padding: 0 6px; margin-top: 5px; text-align: center;" onclick="wordClick(\''+data.name+'\')">查看相关内容 ></div>' } },
2.将window.wordClick事件绑定为vue组件中的方法。就可以在vue中拿到相关数据了
created() { window.wordClick = this.click; }, methods: { click(name){ console.log(name); } }