更新菜单返回结构child改为children
This commit is contained in:
parent
d5f9efeceb
commit
c1c91727de
|
@ -21,7 +21,7 @@ export default class topNav extends React.Component{
|
|||
showlinkmenu(e,item){
|
||||
let self=this;
|
||||
try{
|
||||
item.child.forEach(item=>{
|
||||
item.children.forEach(item=>{
|
||||
if(item.level ===5){
|
||||
sessionStorage.setItem('pathname2',item.router);
|
||||
throw '终止循环'
|
||||
|
@ -30,11 +30,11 @@ export default class topNav extends React.Component{
|
|||
}catch(e){
|
||||
}
|
||||
self.setState({'linkshowname':item.title});
|
||||
self.setState({'menulinklist':item.child});
|
||||
self.setState({'menulinklist':item.children});
|
||||
|
||||
|
||||
// 防止刷新页面,导航签清空
|
||||
sessionStorage.setItem('menulinklist',JSON.stringify(item.child));
|
||||
sessionStorage.setItem('menulinklist',JSON.stringify(item.children));
|
||||
sessionStorage.setItem('showflag',true);
|
||||
sessionStorage.setItem('linkshowname',item.title);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ export default class topNav extends React.Component{
|
|||
{
|
||||
this.state.navlists.map((item,i)=>{
|
||||
return (
|
||||
item.child&&item.child.length>0?<Link key={i} to={item.router} style={this.state.linkshowname==item.title?{width:"#100%",background:"#f2f4f7",color:'#296bef'}:null} className={this.state.linkshowname==item.title?'active':''} onClick={(e)=>this.showlinkmenu(e,item)} >{item.title}</Link>:null
|
||||
item.children&&item.children.length>0?<Link key={i} to={item.router} style={this.state.linkshowname==item.title?{width:"#100%",background:"#f2f4f7",color:'#296bef'}:null} className={this.state.linkshowname==item.title?'active':''} onClick={(e)=>this.showlinkmenu(e,item)} >{item.title}</Link>:null
|
||||
|
||||
)
|
||||
})
|
||||
|
@ -95,7 +95,7 @@ export default class topNav extends React.Component{
|
|||
<div className="linkmenu-row" >
|
||||
{
|
||||
this.state.menulinklist.map((item,key)=>{
|
||||
return(item.level==5?<Link key={key} to={item.router} onClick={()=>this.btnfn(item)} className={pathnameBreak==item.router&&item.child.length>=1?'menuactive':''}>{item.title}</Link>:null)
|
||||
return(item.level==5?<Link key={key} to={item.router} onClick={()=>this.btnfn(item)} className={pathnameBreak==item.router&&item.children.length>=1?'menuactive':''}>{item.title}</Link>:null)
|
||||
}) }
|
||||
</div>
|
||||
<span>数据最后更新时间:{window.timeshow}</span>
|
||||
|
|
|
@ -57,10 +57,10 @@ function FormDom(props) {
|
|||
sessionStorage.setItem('activeMenu',JSON.stringify(response.menu));
|
||||
try{
|
||||
menuList.forEach(item=>{
|
||||
if(item.child&&item.child.length>0){
|
||||
let obj=item.child.filter(item=>item.level==5);
|
||||
if(item.children&&item.children.length>0){
|
||||
let obj=item.children.filter(item=>item.level==5);
|
||||
sessionStorage.setItem('pathname2',obj[0].router);
|
||||
sessionStorage.setItem('menulinklist',JSON.stringify(item.child));
|
||||
sessionStorage.setItem('menulinklist',JSON.stringify(item.children));
|
||||
if(item.id==16){
|
||||
sessionStorage.setItem('linkshowname',"营销计划管理");
|
||||
setTimeout(()=>{
|
||||
|
|
Loading…
Reference in New Issue