Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 10239b5

Browse files
committed
Fix events of Anchor component
1 parent b04eecb commit 10239b5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

framework/react/components/Anchor.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export default function Anchor(props: AnchorProps) {
3232
['data-active-style']: activeStyle,
3333
className: propClassName,
3434
style: propStyle,
35+
onClick: propOnClick,
36+
onMouseEnter: propOnMouseEnter,
3537
children,
3638
...rest
3739
} = props
@@ -101,17 +103,17 @@ export default function Anchor(props: AnchorProps) {
101103
}
102104
}, [isCurrent])
103105
const onMouseEnter = useCallback((e: MouseEvent) => {
104-
if (util.isFunction(props.onMouseEnter)) {
105-
props.onMouseEnter(e)
106+
if (util.isFunction(propOnMouseEnter)) {
107+
propOnMouseEnter(e)
106108
}
107109
if (e.defaultPrevented) {
108110
return
109111
}
110112
prefetch()
111113
}, [prefetch])
112114
const onClick = useCallback((e: MouseEvent) => {
113-
if (util.isFunction(props.onMouseEnter)) {
114-
props.onMouseEnter(e)
115+
if (util.isFunction(propOnClick)) {
116+
propOnClick(e)
115117
}
116118
if (e.defaultPrevented || isModifiedEvent(e)) {
117119
return

0 commit comments

Comments
 (0)