Umi: 如何才能动态增加路由?

Created on 19 Dec 2018  ·  9Comments  ·  Source: umijs/umi

目前有个项目,想在登录成功后,请求后端接口,返回路由信息,动态添加到router中。。
因为是使用的ant design pro 的脚手架。。所以路由配置是在config/router.config.js 接着会在src/pages/.umi 会生成一份 router.js。
但是.umi的是会被覆盖的。所以。我如何才能在config/router.config.js 中 通过后端接口 动态增加路由呢?

type(documentation)

Most helpful comment

All 9 comments

有同样的疑问

config/router.config.js 最终会导入到BasicLayout.js之中,在BasicLayout.js之中操作数组

在BasicLayout里面处理那个数组,只是隐藏了,用户输入相应的url路径还是能访问到页面。

有同样的疑问并且做过各种尝试都无效

有同样的疑问

参考这个例子,https://github.com/umijs/umi-examples/tree/master/runtime-routes-appjs
能不能在model或者是运行后更新路由并重新渲染呢?

目前有个项目,想在登录成功后,请求后端接口,返回路由信息,动态添加到router中。。
因为是使用的ant design pro 的脚手架。。所以路由配置是在config/router.config.js 接着会在src/pages/.umi 会生成一份 router.js。
但是.umi的是会被覆盖的。所以。我如何才能在config/router.config.js 中 通过后端接口 动态增加路由呢?

请问解决这个问题了吗

同样的疑问

Was this page helpful?
0 / 5 - 0 ratings

Related issues

y2891663091 picture y2891663091  ·  4Comments

sorrycc picture sorrycc  ·  4Comments

ddzy picture ddzy  ·  3Comments

stoneWeb picture stoneWeb  ·  3Comments

six-666 picture six-666  ·  3Comments