1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| // 当 props.parentMenu 不存在时,尝试访问其 isRootMenu 属性会导致错误
var getPopupCOntainer= props.parentMenu && props.parentMenu.isRootMenu ? props.parentMenu.props.getPopupContainer : function (triggerNode) { return triggerNode.parentNode; };
SubMenu.prototype.renderChildren = function renderChildren(children) { var props = this.props; var baseProps = { mode: props.mode === 'horizontal' ? 'vertical' : props.mode, visible: this.props.isOpen, level: props.level + 1, inlineIndent: props.inlineIndent, focusable: false, onClick: this.onSubMenuClick, onSelect: this.onSelect, onDeselect: this.onDeselect, onDestroy: this.onDestroy, selectedKeys: props.selectedKeys, eventKey: props.eventKey + '-menu-', openKeys: props.openKeys, openTransitionName: props.openTransitionName, openAnimation: props.openAnimation, onOpenChange: this.onOpenChange, subMenuOpenDelay: props.subMenuOpenDelay, parentMenu: this, // 确保 parentMenu 存在且 isRootMenu 设置正确 subMenuCloseDelay: props.subMenuCloseDelay, forceSubMenuRender: props.forceSubMenuRender, triggerSubMenuAction: props.triggerSubMenuAction, builtinPlacements: props.builtinPlacements, defaultActiveFirst: props.store.getState().defaultActiveFirst[(0, _util.getMenuIdFromSubMenuEventKey)(props.eventKey)], multiple: props.multiple, prefixCls: props.rootPrefixCls, id: this._menuId, manualRef: this.saveMenuInstance, itemIcon: props.itemIcon, expandIcon: props.expandIcon }; }; |