import React, { Component } from 'react'; import '../content.less'; import LeftTab from './leftTab'; import UserList from './userList'; class Content extends Component { constructor() { super(); this.state = { loading: false, component:
, }; } componentWillMount () { if (window.location.hash) { this.getKey(window.location.hash.substr(1)); } else { this.getKey(window.showCustomer ? 'customerList' : 'userList'); }; } getKey (key) { switch (key) { case 'userList': require.ensure([], () => { const UserList = require('./userList').default; this.setState({ component: , }); }); break; case 'orgList': require.ensure([], () => { const OrgList = require('./orgList').default; this.setState({ component: , }); }); break; case 'customerList': require.ensure([], () => { const CustomerList = require('./customerList').default; this.setState({ component: , }); }); break; case 'levelSet': require.ensure([], () => { const LevelSet = require('./levelSet').default; this.setState({ component: , }); }); break; case 'customerSearch': require.ensure([], () => { const CustomerSearch = require('./customerSearch').default; this.setState({ component: , }); }); break; case 'highTechSearch': require.ensure([], () => { const HighTechSearch = require('./highTechSearch').default; this.setState({ component: , }); }); break; }; window.location.hash = key; } render () { return (
{this.state.component}
) } } export default Content;