mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
Add animation for dropdown submenu, ref #797
This commit is contained in:
parent
d79562075a
commit
ba51e65c3d
@ -9,8 +9,12 @@ export default React.createClass({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
render: function () {
|
render: function () {
|
||||||
|
const { overlay, ...otherProps } = this.props;
|
||||||
|
const menu = React.cloneElement(overlay, {
|
||||||
|
openTransitionName: 'zoom-big',
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<Dropdown {...this.props} />
|
<Dropdown {...otherProps} overlay={menu} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -40,35 +40,43 @@ const AntMenu = React.createClass({
|
|||||||
this.props.onClose(e);
|
this.props.onClose(e);
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
let openAnimation = '';
|
let openAnimation = this.props.openAnimation || this.props.openTransitionName;
|
||||||
switch (this.props.mode) {
|
if (!openAnimation) {
|
||||||
case 'horizontal':
|
switch (this.props.mode) {
|
||||||
openAnimation = 'slide-up';
|
case 'horizontal':
|
||||||
break;
|
openAnimation = 'slide-up';
|
||||||
case 'vertical':
|
break;
|
||||||
openAnimation = 'zoom-big';
|
case 'vertical':
|
||||||
break;
|
openAnimation = 'zoom-big';
|
||||||
case 'inline':
|
break;
|
||||||
openAnimation = animation;
|
case 'inline':
|
||||||
break;
|
openAnimation = animation;
|
||||||
default:
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 这组属性的目的是
|
let props = {};
|
||||||
// 弹出型的菜单需要点击后立即关闭
|
|
||||||
// 另外,弹出型的菜单的受控模式没有使用场景
|
|
||||||
let props = {
|
|
||||||
openKeys: this.state.openKeys,
|
|
||||||
onClick: this.handleClick,
|
|
||||||
onOpen: this.handleOpenKeys,
|
|
||||||
onClose: this.handleCloseKeys,
|
|
||||||
};
|
|
||||||
const className = this.props.className + ' ' + this.props.prefixCls + '-' + this.props.theme;
|
const className = this.props.className + ' ' + this.props.prefixCls + '-' + this.props.theme;
|
||||||
if (this.props.mode === 'inline') {
|
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 {
|
} else {
|
||||||
return <Menu {...this.props} {...props} className={className} openTransitionName={openAnimation} />;
|
props = {
|
||||||
|
openTransitionName: openAnimation,
|
||||||
|
className,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
return <Menu {...this.props} {...props} />;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
|
transform-origin: 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-submenu:first-child &-submenu-title {
|
&-submenu:first-child &-submenu-title {
|
||||||
|
Loading…
Reference in New Issue
Block a user