当所有其他小节中的一个悬停在上面以突出显示悬停的小节时,我正在尝试更改其颜色。
events={[
{
target: "data",
eventHandlers: {
onMouseOver: () => {
return [{
target: "data",
eventKey: "all",
mutation: (props) => {
return props.style.fill === "#969696" ?
{ style:{ fill: "#252525"} , text: "clicked"} : { style:{ fill: "#969696"} , text: "clicked"}
}
}];
},
onMouseOut: () => {
return [{
target: "data",
eventKey:"all",
mutation: (props) => {
return props.style.fill === "#969696" ?
{ style:{ fill: "#252525"} , text: "clicked"} : { style:{ fill: "#969696"} , text: "clicked"}
}
}];
}
}
}
]}
首先,所有小节都在改变颜色,包括悬停的颜色。
我遇到了一个叫做eventKey
的东西,所以我在想是否可以传递被悬停的元素的eventKey
,然后以某种方式从eventKey
中删除它的突变函数。
如何将悬停的栏的eventKey
传递给事件,并在突变函数中连同所有事件键一起访问它?甚至有可能吗?
有指导吗?