import React, { Component } from "react"; import "../content.less"; import "./content.less"; import LeftTab from "../leftTab"; import { getMenu } from "../publicMenu.js"; class Content extends Component { constructor() { super(); this.state = { loading: false, component:
, }; } componentWillMount() { var ids = window.location.href.indexOf("rid="); var idk = window.location.href.substr(ids + 4); var rid = idk.split("#"); let menu = getMenu(rid); let curry; if (menu[0].subMenus.length > 0) { curry = menu[0].subMenus[0].url.split("#"); } else { curry = menu[0].url.split("#"); } if (window.location.hash) { this.getKey(window.location.hash.substr(1)); } else { this.getKey(curry[1]); } } getKey(key) { switch (key) { // 资金池 case "fundpool": require.ensure([], () => { const Fundpool = require("./amibapage").default; this.setState({ component: , }); }); break; //我的投资 case "myinvestment": require.ensure([], () => { let MyInvestment = require("../financialManage/amiba/investment").default; this.setState({ component: , }); }); break; // 资金管理 case "fundmanagement": require.ensure([], () => { const FundManagement = require("./amibapage/fundmanagement").default; this.setState({ component: , }); }); break; //空白 default: require.ensure([], () => { const Module = require("../module").default; this.setState({ component: , }); }); } window.location.hash = key; } render() { return (
{this.state.component}
); } } export default Content;