let menuTmp=[{ path:"fast", name:"极速" }, { path:"school", name:"学校" }, { path:"card", name:"卡" },] let menu=[] if(false&&null){ menuTmp.forEach(item => { if ([fast].includes(item.path)) { menu.push(item) } }) }else{ menu=menuTmp } console.log(menu)