feat: menu support forceSubMenuRender

pull/3150/head
tanjinzhou 2020-11-09 17:55:11 +08:00
parent 17c7cb30a3
commit c07d1eab41
1 changed files with 4 additions and 1 deletions

View File

@ -116,6 +116,7 @@ const SubPopupMenu = {
expandIcon: PropTypes.any, expandIcon: PropTypes.any,
overflowedIndicator: PropTypes.any, overflowedIndicator: PropTypes.any,
children: PropTypes.any.def([]), children: PropTypes.any.def([]),
forceSubMenuRender: PropTypes.looseBool,
}, },
{ {
prefixCls: 'rc-menu', prefixCls: 'rc-menu',
@ -303,7 +304,6 @@ const SubPopupMenu = {
openAnimation: props.openAnimation, openAnimation: props.openAnimation,
subMenuOpenDelay: props.subMenuOpenDelay, subMenuOpenDelay: props.subMenuOpenDelay,
subMenuCloseDelay: props.subMenuCloseDelay, subMenuCloseDelay: props.subMenuCloseDelay,
forceSubMenuRender: props.forceSubMenuRender,
builtinPlacements: props.builtinPlacements, builtinPlacements: props.builtinPlacements,
itemIcon: this.getIcon(child, 'itemIcon') || this.getIcon(this, 'itemIcon'), itemIcon: this.getIcon(child, 'itemIcon') || this.getIcon(this, 'itemIcon'),
expandIcon: this.getIcon(child, 'expandIcon') || this.getIcon(this, 'expandIcon'), expandIcon: this.getIcon(child, 'expandIcon') || this.getIcon(this, 'expandIcon'),
@ -318,6 +318,9 @@ const SubPopupMenu = {
// destroy: this.onDestroy, // destroy: this.onDestroy,
onSelect: this.onSelect, onSelect: this.onSelect,
}; };
if (props.forceSubMenuRender !== undefined) {
newChildProps.forceSubMenuRender = props.forceSubMenuRender;
}
// ref: https://github.com/ant-design/ant-design/issues/13943 // ref: https://github.com/ant-design/ant-design/issues/13943
if (props.mode === 'inline' || isMobileDevice()) { if (props.mode === 'inline' || isMobileDevice()) {
newChildProps.triggerSubMenuAction = 'click'; newChildProps.triggerSubMenuAction = 'click';