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