content.jsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import React from 'react';
  2. import '../../content.less';
  3. import LeftTab from '../leftTab.jsx';
  4. import Module from '../../module'
  5. const Content = React.createClass({
  6. getInitialState() {
  7. return {
  8. loading: false,
  9. leftKey: 'comprehensive',
  10. };
  11. },
  12. handlekey(key) {
  13. this.setState({
  14. leftKey: key,
  15. });
  16. window.location.hash = key;
  17. },
  18. componentWillMount(){
  19. if ( window.location.hash ) {
  20. this.handlekey(window.location.hash.substr(1));
  21. };
  22. },
  23. render() {
  24. return (
  25. <div className="manage-content">
  26. <LeftTab handlekey={this.handlekey} />
  27. <div className="content-right">
  28. {(() => {
  29. switch (this.state.leftKey) {
  30. case '212':
  31. return <Module />;
  32. default:
  33. return <Module />;
  34. };
  35. })()}
  36. </div>
  37. </div>
  38. )
  39. }
  40. });
  41. export default Content;