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){
}