ant-design/components/dropdown/demo/basic.md
2022-04-21 18:05:39 +08:00

1.2 KiB

order title
0
zh-CN en-US
基本 Basic

zh-CN

最简单的下拉菜单。

en-US

The most basic dropdown menu.

import { Menu, Dropdown } from 'antd';
import { DownOutlined, SmileOutlined } from '@ant-design/icons';

const menu = (
  <Menu
    items={[
      {
        label: (
          <a target="_blank" rel="noopener noreferrer" href="https://www.antgroup.com">
            1st menu item
          </a>
        ),
      },
      {
        label: (
          <a target="_blank" rel="noopener noreferrer" href="https://www.aliyun.com">
            2nd menu item (disabled)
          </a>
        ),
        icon: <SmileOutlined />,
        disabled: true,
      },
      {
        label: (
          <a target="_blank" rel="noopener noreferrer" href="https://www.luohanacademy.com">
            3rd menu item (disabled)
          </a>
        ),
        disabled: true,
      },
      {
        danger: true,
        label: 'a danger item',
      },
    ]}
  />
);

export default () => (
  <Dropdown overlay={menu}>
    <a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
      Hover me <DownOutlined />
    </a>
  </Dropdown>
);