Merge branch 'feature-3.7.0' of github.com:ant-design/ant-design into feature-3.7.0

This commit is contained in:
afc163 2018-06-13 11:05:55 +08:00
commit c403bd9738
4 changed files with 10 additions and 4 deletions

View File

@ -25,7 +25,7 @@ const menu = (
);
ReactDOM.render(
<Dropdown overlay={menu} trigger={['contextMenu']} alignPoint>
<Dropdown overlay={menu} trigger={['contextMenu']}>
<span style={{ userSelect: 'none' }}>Right Click on Me</span>
</Dropdown>
, mountNode);

View File

@ -68,11 +68,19 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
selectable,
focusable,
});
const triggerActions = disabled ? [] : trigger;
let alignPoint;
if (triggerActions && triggerActions.indexOf('contextMenu') !== -1) {
alignPoint = true;
}
return (
<RcDropdown
alignPoint={alignPoint}
{...this.props}
transitionName={this.getTransitionName()}
trigger={disabled ? [] : trigger}
trigger={triggerActions}
overlay={fixedModeOverlay}
>
{dropdownTrigger}

View File

@ -23,7 +23,6 @@ If there are too many operations to display, you can wrap them in a `Dropdown`.
| trigger | the trigger mode which executes the drop-down action | Array&lt;`click`\|`hover`\|`contextMenu`> | `['hover']` |
| visible | whether the dropdown menu is visible | boolean | - |
| onVisibleChange | a callback function takes an argument: `visible`, is executed when the visible state is changed | Function(visible) | - |
| alignPoint | whether the dropdown menu follow the mouse position | bool | - |
You should use [Menu](/components/menu/) as `overlay`. The menu items and dividers are also available by using `Menu.Item` and `Menu.Divider`.

View File

@ -24,7 +24,6 @@ title: Dropdown
| trigger | 触发下拉的行为 | Array&lt;`click`\|`hover`\|`contextMenu`> | `['hover']` |
| visible | 菜单是否显示 | boolean | - |
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function(visible) | - |
| alignPoint | 菜单是否跟随鼠标位置 | bool | - |
`overlay` 菜单使用 [Menu](/components/menu/),还包括菜单项 `Menu.Item`,分割线 `Menu.Divider`