import React from 'react'
import { Anchor } from 'antd';
import { Layout } from 'are-common';
const { Sider, Content } = Layout;
const { Link } = Anchor;
const hello: React.FC = (props) => {
// const [targetOffset, setTargetOffset] = useState<number | undefined>(undefined);
// useEffect(() => {
// setTargetOffset(window.innerHeight / 2);
// }, []);
return (
<Layout>
<Layout>
<Content>
<div id="a">
<div style={{ height: "1000px" }} id="components-anchor-demo-basic">asasdasdas</div>
<div style={{ height: "1000px" }} id="components-anchor-demo-static">assdf</div>
</div>
</Content>
<Sider style={{background: "#E6E6FA"}}><div style={{ position:"fixed",top:"500px"}}><Anchor affix={false}>
<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></div></Sider>
</Layout>
</Layout>
)
}
export default hello;
react使用antd(ant design)锚点并悬浮
最新推荐文章于 2024-06-12 09:55:46 发布