Vue-element-admin: addRoutes添加动态路由失效

Created on 12 Apr 2018  ·  1Comment  ·  Source: PanJiaChen/vue-element-admin

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始终没加上异步的路由,但是页面为什么却显示出来了,我在自己的项目就直接报错了

Most helpful comment

addRoutes成功后,不会改变router.options.routes里面的数据,渲染菜单用的是vuex里的数据

>All comments

addRoutes成功后,不会改变router.options.routes里面的数据,渲染菜单用的是vuex里的数据

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ExtremeYu picture ExtremeYu  ·  4Comments

343512292 picture 343512292  ·  3Comments

eladcandroid picture eladcandroid  ·  4Comments

TianYouH picture TianYouH  ·  4Comments

yanlee26 picture yanlee26  ·  3Comments