mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-14 08:51:26 +08:00
26 lines
704 B
TypeScript
26 lines
704 B
TypeScript
|
import React, { useEffect, useState } from 'react';
|
||
|
import { Anchor } from 'antd';
|
||
|
|
||
|
const { Link } = Anchor;
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [targetOffset, setTargetOffset] = useState<number | undefined>(undefined);
|
||
|
|
||
|
useEffect(() => {
|
||
|
setTargetOffset(window.innerHeight / 2);
|
||
|
}, []);
|
||
|
|
||
|
return (
|
||
|
<Anchor targetOffset={targetOffset}>
|
||
|
<Link href="#components-anchor-demo-basic" title="Basic demo" />
|
||
|
<Link href="#components-anchor-demo-static" title="Static demo" />
|
||
|
<Link href="#API" title="API">
|
||
|
<Link href="#Anchor-Props" title="Anchor Props" />
|
||
|
<Link href="#Link-Props" title="Link Props" />
|
||
|
</Link>
|
||
|
</Anchor>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|