Browse Source

liguoqing

JERRY\15194 4 years ago
parent
commit
feade6e17a
2 changed files with 12 additions and 5 deletions
  1. 1 1
      boniu/.eslintcache
  2. 11 4
      boniu/src/components/Navbar/navbar.jsx

File diff suppressed because it is too large
+ 1 - 1
boniu/.eslintcache


+ 11 - 4
boniu/src/components/Navbar/navbar.jsx

@@ -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}>