待改善的代码整理

1.构建动态菜单栏

/*
   * 根据用户点击的导航菜单栏 动态渲染左侧导航
   * @zxyuns --2017-1018
   *
   * */
  renderMenus = (pathKye) => {
    console.log('pathKey', pathKye);
    //LeftMenus.map()
    const currentObj = LeftMenus[pathKye];
    console.log("currentObj", currentObj);

     return currentObj.map((obj, idx) =>{
       return (
         <SubMenu key={idx} title={<span><Icon type="appstore" /><span>{obj.title}</span></span>}>
           {
             obj.children && obj.children > 0 ? obj.children.map((item, keys) =>{
               return (
                 <Menu.Item key={keys}>{item.title}</Menu.Item>
               )
             }) : []
           }
           }
         </SubMenu>
       )
     });
  };
原文地址:https://www.cnblogs.com/zxyun/p/7685240.html