index.jsx 837 字节
Newer Older
Y
yiminghe 已提交
1
import React from 'react';
J
jljsj 已提交
2
import Menu from 'rc-menu';
Y
yiminghe 已提交
3
import animation from '../common/openAnimation';
Y
yiminghe 已提交
4 5

const AntMenu = React.createClass({
J
jljsj 已提交
6
  getDefaultProps() {
Y
yiminghe 已提交
7 8 9 10
    return {
      prefixCls: 'ant-menu'
    };
  },
J
jljsj 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24
  render() {
    let openAnimation = '';
    switch (this.props.mode) {
      case 'horizontal':
        openAnimation = 'slide-up';
        break;
      case 'vertical':
        openAnimation = 'zoom';
        break;
      case 'inline':
        openAnimation = animation;
        break;
    }
    if (this.props.mode === 'inline') {
A
afc163 已提交
25
      return <Menu {...this.props} openAnimation={openAnimation} />;
J
jljsj 已提交
26
    } else {
A
afc163 已提交
27
      return <Menu {...this.props} openTransitionName={openAnimation} />;
J
jljsj 已提交
28
    }
Y
yiminghe 已提交
29 30 31 32 33 34 35 36
  }
});

AntMenu.Divider = Menu.Divider;
AntMenu.Item = Menu.Item;
AntMenu.SubMenu = Menu.SubMenu;

export default AntMenu;