0%

React 阻止事件冒泡

需求

阻止事件冒泡

解决方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<Link
onClick={(event: {
preventDefault: () => void,
stopPropagation: () => void,
nativeEvent: { stopImmediatePropagation: () => void },
}) => {
event.preventDefault();
event.stopPropagation();
event.nativeEvent.stopImmediatePropagation();
onSelect(item);
}}
>
{item.operationName}
</Link>