123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import React, { Component } from 'react';
- import '../content.less';
- import LeftTab from './leftTab';
- import TechAchievement from './techAchievement';
- class Content extends Component {
- constructor() {
- super();
- this.state = {
- loading: false,
- component: 'div'
- };
- }
- componentWillMount() {
- if (window.location.hash) {
- this.getKey(window.location.hash.substr(1));
- } else {
- this.getKey("techAchievement");
- };
- }
- getKey(key) {
- switch (key) {
- case 'techAchievement':
- require.ensure([], () => {
- const TechDemand = require('./techAchievement').default;
- this.setState({
- component: TechAchievement
- });
- });
- break;
- };
- window.location.hash = key;
- }
- render() {
- return (
- <div className="acc-content">
- <LeftTab handlekey={this.getKey.bind(this)} />
- <div className="content-right">
- <this.state.component />
- </div>
- </div>
- )
- }
- }
- export default Content;
|