Browse Source

menu cannot be selectable in dropdown defaultly

pull/7403/head
afc163 7 years ago
parent
commit
3ceda311b6
  1. 5
      components/dropdown/dropdown.tsx
  2. 2
      components/dropdown/index.en-US.md
  3. 2
      components/dropdown/index.zh-CN.md
  4. 1
      components/menu/index.tsx

5
components/dropdown/dropdown.tsx

@ -48,8 +48,13 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
const dropdownTrigger = cloneElement(children as any, {
className: classNames((children as any).props.className, `${prefixCls}-trigger`),
});
// menu cannot be selectable in dropdown defaultly
const overlayProps = overlay && (overlay as any).props;
const selectable = (overlayProps && 'selectable' in overlayProps)
? overlayProps.selectable : false;
const fixedModeOverlay = cloneElement(overlay as any, {
mode: 'vertical',
selectable,
});
return (
<RcDropdown

2
components/dropdown/index.en-US.md

@ -27,7 +27,7 @@ You can get the menu list by `antd.Menu`, and set a callback function `onSelect`
> Warning: You must set a unique `key` for `Menu.Item`.
> Remove the highlighted style after click menu item via `<Menu selectable={false}>`.
> Menu of Dropdown is unselectable defaultly, you can make it selectable via `<Menu selectable>`.
### Dropdown.Button

2
components/dropdown/index.zh-CN.md

@ -28,7 +28,7 @@ title: Dropdown
> 注意: Menu.Item 必须设置唯一的 key 属性。
> 如果希望去掉菜单选中的背景效果,可以指定 `<Menu selectable={false}>`.
> Dropdown 下的 Menu 默认不可选中。如果需要菜单可选中,可以指定 `<Menu selectable>`.
### Dropdown.Button

1
components/menu/index.tsx

@ -55,7 +55,6 @@ export default class Menu extends React.Component<MenuProps, any> {
prefixCls: 'ant-menu',
className: '',
theme: 'light', // or dark
selectable: true,
};
static childContextTypes = {
inlineCollapsed: PropTypes.bool,

Loading…
Cancel
Save