mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-20 04:24:29 +08:00
a67d39cd6c
* docs: Update Menu cn doc * chore: update ts def * chore: support convert * docs: more demo * docs: more demo * docs: all menu demos * docs: dropdown demo * docs: dropdown all demos * docs: update demo * test: coverage * docs: more demo * docs: layout demo * docs: all demo * chore: fix ts lint * docs: fix doc * docs: all docs
68 lines
1.0 KiB
Markdown
68 lines
1.0 KiB
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
|
|
items={[
|
|
{
|
|
label: '1st menu item',
|
|
key: '1',
|
|
},
|
|
{
|
|
label: '2nd menu item',
|
|
key: '2',
|
|
},
|
|
{
|
|
label: '3rd menu item',
|
|
key: '3',
|
|
},
|
|
]}
|
|
/>
|
|
);
|
|
|
|
ReactDOM.render(
|
|
<Dropdown overlay={menu} trigger={['contextMenu']}>
|
|
<div
|
|
className="site-dropdown-context-menu"
|
|
style={{
|
|
textAlign: 'center',
|
|
height: 200,
|
|
lineHeight: '200px',
|
|
}}
|
|
>
|
|
Right Click on here
|
|
</div>
|
|
</Dropdown>,
|
|
mountNode,
|
|
);
|
|
```
|
|
|
|
```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>
|