leftTab.jsx 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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: 'statistics'
  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. let array = window.adminData.shiroList.split(",");
  25. return (
  26. <Menu onClick={this.handleClick}
  27. selectedKeys={[this.state.current]}
  28. mode="vertical"
  29. className="account-left" >
  30. <Menu.Item
  31. key={array.includes("1") ? "statistics" : "no"}>
  32. 数据统计
  33. </Menu.Item>
  34. <Menu.Item key="normal">
  35. 常用功能
  36. </Menu.Item>
  37. <Menu.Item key="contacts">
  38. 常用联系人
  39. </Menu.Item>
  40. </Menu>
  41. );
  42. },
  43. });
  44. export default LeftTab;