leftTab.jsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from 'react';
  2. import { Menu, Icon } from 'antd';
  3. import '../leftTab.less';
  4. const SubMenu = Menu.SubMenu;
  5. const MenuItemGroup = Menu.ItemGroup;
  6. const LeftTab = React.createClass({
  7. getInitialState() {
  8. return {
  9. current: 'normal'
  10. };
  11. },
  12. handleClick(e) {
  13. this.props.handlekey(e.key);
  14. this.setState({
  15. current: e.key,
  16. });
  17. },
  18. componentWillMount() {
  19. if (window.location.hash) {
  20. this.state.current = window.location.hash.substr(1);
  21. };
  22. },
  23. render() {
  24. return (
  25. <Menu onClick={this.handleClick}
  26. selectedKeys={[this.state.current]}
  27. mode="vertical"
  28. className="account-left" >
  29. <Menu.Item key="normal">
  30. 常用功能
  31. </Menu.Item>
  32. <Menu.Item key="contacts">
  33. 常用联系人
  34. </Menu.Item>
  35. </Menu>
  36. );
  37. },
  38. });
  39. export default LeftTab;