|
|
@@ -22,8 +22,15 @@ class NavBar extends Component {
|
|
|
userInfo: {}
|
|
|
};
|
|
|
}
|
|
|
- navDeFault = (info) => {
|
|
|
- this.props.history.push({pathname: info.url, state: info})
|
|
|
+ clickHandler = (arr) => {
|
|
|
+ const stocks = stocksApiList[0]
|
|
|
+ const index = indexApiList[0]
|
|
|
+ console.log(arr)
|
|
|
+ if (arr.includes('stocks')) {
|
|
|
+ this.props.history.push({pathname: stocks.url, state: stocks})
|
|
|
+ } else if (arr.includes('indexApi')) {
|
|
|
+ this.props.history.push({pathname: index.url, state: index})
|
|
|
+ }
|
|
|
}
|
|
|
render() {
|
|
|
// let { match } = this.props;
|
|
|
@@ -37,6 +44,7 @@ class NavBar extends Component {
|
|
|
<Layout>
|
|
|
<Sider width={200} className="site-layout-background">
|
|
|
<Menu
|
|
|
+ onOpenChange={ (arr) => this.clickHandler(arr) }
|
|
|
mode="inline"
|
|
|
defaultSelectedKeys={["overview"]}
|
|
|
defaultOpenKeys={["overview"]}
|
|
|
@@ -46,8 +54,7 @@ class NavBar extends Component {
|
|
|
<Menu.Item key="overview" icon={<UserOutlined />}>
|
|
|
<Link to="/overview">总体说明</Link>
|
|
|
</Menu.Item>
|
|
|
- <SubMenu key="stocks" icon={<LaptopOutlined />} title="股票接口"
|
|
|
- onTitleClick={ () => this.navDeFault(stocksApiList[0]) }>
|
|
|
+ <SubMenu key="stocks" icon={<LaptopOutlined />} title="股票接口">
|
|
|
{stocksApiList.map((item) => {
|
|
|
return (
|
|
|
<Menu.Item key={item.key}>
|