feat(dropdown): add dropdown destroyPopupOnHide type (#4768)

Co-authored-by: WangYang <yang.wang@cue.group>
1.x
WangYang 2021-10-16 21:59:20 +08:00 committed by tangjinzhou
parent 441024b993
commit 233ef9f2cf
4 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@
| Property | Description | Type | Default |
| --- | --- | --- | --- |
| disabled | whether the dropdown menu is disabled | boolean | - |
| destroyPopupOnHide | Whether destroy dropdown when hidden | boolean | false | |
| getPopupContainer | to set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. [example](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | `() => document.body` |
| overlay(slot-scope) | the dropdown menu | [Menu](/components/menu) | - |
| overlayClassName | Class name of the dropdown root element | string | - |

View File

@ -5,6 +5,7 @@
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| disabled | 菜单是否禁用 | boolean | - |
| destroyPopupOnHide | 关闭后是否销毁 Dropdown | boolean | false | |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。 | Function(triggerNode) | `() => document.body` |
| overlay(slot-scope) | 菜单 | [Menu](/components/menu-cn) | - |
| overlayClassName | 下拉根元素的类名称 | string | - |

View File

@ -23,4 +23,5 @@ export default () => ({
mouseLeaveDelay: PropTypes.number,
openClassName: PropTypes.string,
minOverlayWidthMatchTrigger: PropTypes.bool,
destroyPopupOnHide: PropTypes.bool,
});

View File

@ -9,6 +9,7 @@ export default {
mixins: [BaseMixin],
props: {
minOverlayWidthMatchTrigger: PropTypes.bool,
destroyPopupOnHide: PropTypes.bool.def(false),
prefixCls: PropTypes.string.def('rc-dropdown'),
transitionName: PropTypes.string,
overlayClassName: PropTypes.string.def(''),
@ -169,6 +170,7 @@ export default {
overlayClassName,
overlayStyle,
trigger,
destroyPopupOnHide,
...otherProps
} = this.$props;
let triggerHideAction = hideAction;
@ -180,6 +182,7 @@ export default {
props: {
...otherProps,
prefixCls,
destroyPopupOnHide,
popupClassName: overlayClassName,
popupStyle: overlayStyle,
builtinPlacements: placements,