formatter: (params, ticket, callback) => {
return `<div class='exp-charts-tooltip'>
<a class='exp-charts-tooltip-link' href="javascript:void(0);" onClick=${myCustomFunc(123)}>查看</a>
</div>`
}
How can i handle click event in echarts tooltip formatter, i want to handle event in react component, not global scope, thank you~
Formatter know nothing about you frontend-framework, it makes no sense to return from it something except HTML. I'm not use React but there must be a way to call handler outside. Anyway you can try to handle click
from the global scope:
document.querySelector('body').addEventListener('click', e => {
if(e.target.classList.contains('exp-charts-tooltip-link')){
// do something ...
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.