Anne3

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

 

 

 以上为效果图,参考链接: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);
            }
        }

  

发表于 2020-12-28 14:52  Anne3  阅读(2914)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章: