diff --git a/antdv-demo/docs/dropdown/index.en-US.md b/antdv-demo/docs/dropdown/index.en-US.md index 1c7a78fd0..3e13e76ee 100644 --- a/antdv-demo/docs/dropdown/index.en-US.md +++ b/antdv-demo/docs/dropdown/index.en-US.md @@ -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 | - | diff --git a/antdv-demo/docs/dropdown/index.zh-CN.md b/antdv-demo/docs/dropdown/index.zh-CN.md index 9856b669d..f29bce507 100644 --- a/antdv-demo/docs/dropdown/index.zh-CN.md +++ b/antdv-demo/docs/dropdown/index.zh-CN.md @@ -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 | - | diff --git a/components/dropdown/getDropdownProps.js b/components/dropdown/getDropdownProps.js index baefe22e4..fcd639606 100644 --- a/components/dropdown/getDropdownProps.js +++ b/components/dropdown/getDropdownProps.js @@ -23,4 +23,5 @@ export default () => ({ mouseLeaveDelay: PropTypes.number, openClassName: PropTypes.string, minOverlayWidthMatchTrigger: PropTypes.bool, + destroyPopupOnHide: PropTypes.bool, }); diff --git a/components/vc-dropdown/src/Dropdown.jsx b/components/vc-dropdown/src/Dropdown.jsx index a708d2a7a..ec5b0e70a 100644 --- a/components/vc-dropdown/src/Dropdown.jsx +++ b/components/vc-dropdown/src/Dropdown.jsx @@ -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,