mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-29 03:48:26 +08:00
38cf5e8a75
* docs: unify component export file as index.tsx * docs: compatible with old anchors * chore: clean * test: update snapshot * fix: window env --------- Co-authored-by: Peach <scdzwyxst@gmail.com>
52 lines
907 B
TypeScript
52 lines
907 B
TypeScript
import React from 'react';
|
|
import { Anchor } from 'antd';
|
|
|
|
const handleClick = (
|
|
e: React.MouseEvent<HTMLElement>,
|
|
link: {
|
|
title: React.ReactNode;
|
|
href: string;
|
|
},
|
|
) => {
|
|
e.preventDefault();
|
|
console.log(link);
|
|
};
|
|
|
|
const App: React.FC = () => (
|
|
<Anchor
|
|
affix={false}
|
|
onClick={handleClick}
|
|
items={[
|
|
{
|
|
key: '1',
|
|
href: '#anchor-demo-basic',
|
|
title: 'Basic demo',
|
|
},
|
|
{
|
|
key: '2',
|
|
href: '#anchor-demo-static',
|
|
title: 'Static demo',
|
|
},
|
|
{
|
|
key: '3',
|
|
href: '#api',
|
|
title: 'API',
|
|
children: [
|
|
{
|
|
key: '4',
|
|
href: '#anchor-props',
|
|
title: 'Anchor Props',
|
|
},
|
|
{
|
|
key: '5',
|
|
href: '#link-props',
|
|
title: 'Link Props',
|
|
},
|
|
],
|
|
},
|
|
]}
|
|
/>
|
|
);
|
|
|
|
export default App;
|