{ path:‘/‘,component:Recommend,beforeEnter: (to, from, next) => { console.log(to); ajax(‘get‘,‘/api/mall/categoryList‘,true,‘‘,res=>{ var data=res.data; if(data[0].categoryName=="推荐"){ next({path:‘/Recommend‘,query:{categoryId:data[0].categoryId}}) }else if(data[0].categoryName=="房卡"){ next({path:‘/RoomCard‘,query:{categoryId:data[0].categoryId}}) }else if(data[0].categoryName=="钻石"){ next({path:‘/Diamonds‘,query:{categoryId:data[0].categoryId}}) }else if(data[0].categoryName=="金币"){ next({path:‘/Gold‘,query:{categoryId:data[0].categoryId}}) }else if(data[0].categoryName=="礼包"){ next({path:‘/Package‘,query:{categoryId:data[0].categoryId}}) }else if(data[0].categoryName=="道具"){ next({path:‘/Prop‘,query:{categoryId:data[0].categoryId}}) } }) } },
原文地址:https://www.cnblogs.com/yiyi17/p/8311764.html
时间: 2024-10-06 21:11:58