lijianan
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
4 additions and
4 deletions
-
components/anchor/Anchor.tsx
-
components/anchor/AnchorLink.tsx
-
components/anchor/index.en-US.md
-
components/anchor/index.zh-CN.md
|
|
@ -85,7 +85,7 @@ export interface AntAnchor { |
|
|
|
activeLink: string | null; |
|
|
|
scrollTo: (link: string) => void; |
|
|
|
onClick?: ( |
|
|
|
e: React.MouseEvent<HTMLElement>, |
|
|
|
e: React.MouseEvent<HTMLAnchorElement, MouseEvent>, |
|
|
|
link: { title: React.ReactNode; href: string }, |
|
|
|
) => void; |
|
|
|
} |
|
|
|
|
|
@ -28,7 +28,7 @@ const AnchorLink: React.FC<AnchorLinkProps> = (props) => { |
|
|
|
}; |
|
|
|
}, [href, registerLink, unregisterLink]); |
|
|
|
|
|
|
|
const handleClick = (e: React.MouseEvent<HTMLElement>) => { |
|
|
|
const handleClick = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => { |
|
|
|
onClick?.(e, { title, href }); |
|
|
|
scrollTo?.(href); |
|
|
|
}; |
|
|
|
|
|
@ -43,7 +43,7 @@ For displaying anchor hyperlinks on page and jumping between them. |
|
|
|
| showInkInFixed | Whether show ink-balls when `affix={false}` | boolean | false | | |
|
|
|
| targetOffset | Anchor scroll offset, default as `offsetTop`, [example](#components-anchor-demo-targetOffset) | number | - | | |
|
|
|
| onChange | Listening for anchor link change | (currentActiveLink: string) => void | | | |
|
|
|
| onClick | Set the handler to handle `click` event | function(e: Event, link: Object) | - | | |
|
|
|
| onClick | Set the handler to handle `click` event | (e: MouseEvent, link: object) => void | - | | |
|
|
|
|
|
|
|
### Link Props |
|
|
|
|
|
|
|
|
|
@ -44,7 +44,7 @@ group: |
|
|
|
| showInkInFixed | `affix={false}` 时是否显示小圆点 | boolean | false | | |
|
|
|
| targetOffset | 锚点滚动偏移量,默认与 offsetTop 相同,[例子](#components-anchor-demo-targetOffset) | number | - | | |
|
|
|
| onChange | 监听锚点链接改变 | (currentActiveLink: string) => void | - | | |
|
|
|
| onClick | `click` 事件的 handler | function(e: Event, link: Object) | - | | |
|
|
|
| onClick | `click` 事件的 handler | (e: MouseEvent, link: object) => void | - | | |
|
|
|
|
|
|
|
### Link Props |
|
|
|
|
|
|
|