mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
6776bb8916
* docs: update demo * chore: add script * test: fix demo test * docs: convert demos * chore: move script * test: remove react-dom import * chore: update deps * docs: update riddle js * test: fix image test * docs: fix riddle demo
56 lines
973 B
Markdown
56 lines
973 B
Markdown
---
|
|
order: 8
|
|
title:
|
|
zh-CN: 右键菜单
|
|
en-US: Context Menu
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
默认是移入触发菜单,可以点击鼠标右键触发。
|
|
|
|
## en-US
|
|
|
|
The default trigger mode is `hover`, you can change it to `contextMenu`.
|
|
|
|
```jsx
|
|
import { Menu, Dropdown } from 'antd';
|
|
|
|
const menu = (
|
|
<Menu>
|
|
<Menu.Item key="1">1st menu item</Menu.Item>
|
|
<Menu.Item key="2">2nd menu item</Menu.Item>
|
|
<Menu.Item key="3">3rd menu item</Menu.Item>
|
|
</Menu>
|
|
);
|
|
|
|
export default () => (
|
|
<Dropdown overlay={menu} trigger={['contextMenu']}>
|
|
<div
|
|
className="site-dropdown-context-menu"
|
|
style={{
|
|
textAlign: 'center',
|
|
height: 200,
|
|
lineHeight: '200px',
|
|
}}
|
|
>
|
|
Right Click on here
|
|
</div>
|
|
</Dropdown>
|
|
);
|
|
```
|
|
|
|
```css
|
|
.site-dropdown-context-menu {
|
|
color: #777;
|
|
background: #f7f7f7;
|
|
}
|
|
```
|
|
|
|
<style>
|
|
[data-theme="dark"] .site-dropdown-context-menu {
|
|
background: #141414;
|
|
color: rgba(255,255,255,.65);
|
|
}
|
|
</style>
|