mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-03 00:09:39 +08:00
37 lines
704 B
TypeScript
37 lines
704 B
TypeScript
import React from 'react';
|
|
import { DownOutlined } from '@ant-design/icons';
|
|
import type { MenuProps } from 'antd';
|
|
import { Dropdown, message, Space } from 'antd';
|
|
|
|
const onClick: MenuProps['onClick'] = ({ key }) => {
|
|
message.info(`Click on item ${key}`);
|
|
};
|
|
|
|
const items: MenuProps['items'] = [
|
|
{
|
|
label: '1st menu item',
|
|
key: '1',
|
|
},
|
|
{
|
|
label: '2nd menu item',
|
|
key: '2',
|
|
},
|
|
{
|
|
label: '3rd menu item',
|
|
key: '3',
|
|
},
|
|
];
|
|
|
|
const App: React.FC = () => (
|
|
<Dropdown menu={{ items, onClick }}>
|
|
<a onClick={(e) => e.preventDefault()}>
|
|
<Space>
|
|
Hover me, Click menu item
|
|
<DownOutlined />
|
|
</Space>
|
|
</a>
|
|
</Dropdown>
|
|
);
|
|
|
|
export default App;
|