-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect 引发整个页面重绘 #2259
Comments
Translation of this issue: Redirect Raises the entire page redrawClick on the Menu to switch to this page https://preview.pro.ant.design/form/step-form/info This will cause the ComponentDidMount of BasicLayout to fire again. |
同样的问题, redirect 使 BasicLayout 组件重新构造了. |
@yutingzhao1991 redirect 根据 bigfish 的传统,提到了页面最顶层,所以会 redirect 。 |
当时提到前面是有原因的,不然可能会另外的一个问题: 如果跳转放到后面那么比如类似下面的路由: const routes = [
{
path: '/admin',
component: 'Admin',
},
{
path: '/',
component: 'BasicLayout',
routes: [{
path: '/redirect',
redirect: '/admin',
}]
}]; 这种情况下如果访问 cc @zinkey 除了这个还有其他原因吗? bigfish 之前我有提一个 issue: http://gitlab.alipay-inc.com/bigfish/bigfish/issues/198 |
出于一些原因的考虑,我们在处理路由时把所有 redirect 声明提到路由最前面进行匹配,但这导致了一些问题,所以添加了这个配置项,禁用 redirect 上提。 比如: 1. ant-design/ant-design-pro#2259 2. 下面的路由配置,访问 `/console` 会访问到 `/console/overview`,因为 redirect 规则往前提了。 ``` routes: [{ path: '/', component: 'Index/App', indexRoute: { redirect: '/console' }, routes: [ { path: '/', component: '../components/layout/Default', routes: [ { path: '/console', component: 'Index/Dashboard', }, { path: '/:productName', indexRoute: { redirect: '/:productName/overview' }, routes: [ { path: '/:productName/overview', component: 'Index/product/Overview' }, ] }, ] } ], }], ```
从 Menu 点击切换进入这个页面 https://preview.pro.ant.design/form/step-form/info
会导致 BasicLayout 的 componentDidMount 再次触发。
The text was updated successfully, but these errors were encountered: