content.jsx 1.0 KB

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