console.log(router);
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
console.log(router);
这里打印出来的router始终没加上异步的路由,但是页面为什么却显示出来了,我在自己的项目就直接报错了
addRoutes成功后,不会改变router.options.routes里面的数据,渲染菜单用的是vuex里的数据
Most helpful comment
addRoutes成功后,不会改变router.options.routes里面的数据,渲染菜单用的是vuex里的数据