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