更新菜单返回结构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){
|
showlinkmenu(e,item){
|
||||||
let self=this;
|
let self=this;
|
||||||
try{
|
try{
|
||||||
item.child.forEach(item=>{
|
item.children.forEach(item=>{
|
||||||
if(item.level ===5){
|
if(item.level ===5){
|
||||||
sessionStorage.setItem('pathname2',item.router);
|
sessionStorage.setItem('pathname2',item.router);
|
||||||
throw '终止循环'
|
throw '终止循环'
|
||||||
|
@ -30,11 +30,11 @@ export default class topNav extends React.Component{
|
||||||
}catch(e){
|
}catch(e){
|
||||||
}
|
}
|
||||||
self.setState({'linkshowname':item.title});
|
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('showflag',true);
|
||||||
sessionStorage.setItem('linkshowname',item.title);
|
sessionStorage.setItem('linkshowname',item.title);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ export default class topNav extends React.Component{
|
||||||
{
|
{
|
||||||
this.state.navlists.map((item,i)=>{
|
this.state.navlists.map((item,i)=>{
|
||||||
return (
|
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" >
|
<div className="linkmenu-row" >
|
||||||
{
|
{
|
||||||
this.state.menulinklist.map((item,key)=>{
|
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>
|
</div>
|
||||||
<span>数据最后更新时间:{window.timeshow}</span>
|
<span>数据最后更新时间:{window.timeshow}</span>
|
||||||
|
|
|
@ -57,10 +57,10 @@ function FormDom(props) {
|
||||||
sessionStorage.setItem('activeMenu',JSON.stringify(response.menu));
|
sessionStorage.setItem('activeMenu',JSON.stringify(response.menu));
|
||||||
try{
|
try{
|
||||||
menuList.forEach(item=>{
|
menuList.forEach(item=>{
|
||||||
if(item.child&&item.child.length>0){
|
if(item.children&&item.children.length>0){
|
||||||
let obj=item.child.filter(item=>item.level==5);
|
let obj=item.children.filter(item=>item.level==5);
|
||||||
sessionStorage.setItem('pathname2',obj[0].router);
|
sessionStorage.setItem('pathname2',obj[0].router);
|
||||||
sessionStorage.setItem('menulinklist',JSON.stringify(item.child));
|
sessionStorage.setItem('menulinklist',JSON.stringify(item.children));
|
||||||
if(item.id==16){
|
if(item.id==16){
|
||||||
sessionStorage.setItem('linkshowname',"营销计划管理");
|
sessionStorage.setItem('linkshowname',"营销计划管理");
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
|
Loading…
Reference in New Issue