Add animation for dropdown submenu, ref #797

This commit is contained in:
afc163 2015-12-31 17:55:45 +08:00
parent d79562075a
commit ba51e65c3d
3 changed files with 37 additions and 24 deletions

View File

@ -9,8 +9,12 @@ export default React.createClass({
};
},
render: function () {
const { overlay, ...otherProps } = this.props;
const menu = React.cloneElement(overlay, {
openTransitionName: 'zoom-big',
});
return (
<Dropdown {...this.props} />
<Dropdown {...otherProps} overlay={menu} />
);
}
});

View File

@ -40,35 +40,43 @@ const AntMenu = React.createClass({
this.props.onClose(e);
},
render() {
let openAnimation = '';
switch (this.props.mode) {
case 'horizontal':
openAnimation = 'slide-up';
break;
case 'vertical':
openAnimation = 'zoom-big';
break;
case 'inline':
openAnimation = animation;
break;
default:
let openAnimation = this.props.openAnimation || this.props.openTransitionName;
if (!openAnimation) {
switch (this.props.mode) {
case 'horizontal':
openAnimation = 'slide-up';
break;
case 'vertical':
openAnimation = 'zoom-big';
break;
case 'inline':
openAnimation = animation;
break;
default:
}
}
//
//
// 使
let props = {
openKeys: this.state.openKeys,
onClick: this.handleClick,
onOpen: this.handleOpenKeys,
onClose: this.handleCloseKeys,
};
let props = {};
const className = this.props.className + ' ' + this.props.prefixCls + '-' + this.props.theme;
if (this.props.mode === 'inline') {
return <Menu {...this.props} className={className} openAnimation={openAnimation} />;
//
//
// 使
props = {
openKeys: this.state.openKeys,
onClick: this.handleClick,
onOpen: this.handleOpenKeys,
onClose: this.handleCloseKeys,
openAnimation,
className,
};
} else {
return <Menu {...this.props} {...props} className={className} openTransitionName={openAnimation} />;
props = {
openTransitionName: openAnimation,
className,
};
}
return <Menu {...this.props} {...props} />;
}
});

View File

@ -118,6 +118,7 @@
position: absolute;
min-width: 100%;
margin-left: 4px;
transform-origin: 0 0;
}
&-submenu:first-child &-submenu-title {