VUE 动态注入路由白屏,再次刷新才显示页面问题


router.addRoutes(result);
next({...to,replace:true}) //划重点 一定需要这一句 还是不行

//首页重定项
 let path=首页

self.$router.push(

 {
path: path,
});

//重定向 发现页面刷新 都会回到首页

动态添加添加路由
try(){
if(){
 
router.addRoutes(result);
next({...to,replace:true})
 

}else{
 
if(to.matched.length===0){//判断是否有路由 在追加一次
var c= getAsyncRoutes(parentRoute);
router.addRoutes(c);
next({...to,replace:true})
}

}catch(error){

}







免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM