-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 时,查询参数被删除 #10606
Comments
这个目前是预期的,你可以写一个组件给 |
感谢回复和提供解决方案。但是我不认为这个预期的行为是合理的。主要的原因有: 1、删除参数的这个行为是有侵犯性的。因为参数是开发人员带上去的,而umi 本身是框架,这个角度来说,umi 应该只提供重定向的功能,但是该功能不经过同意删除参数,是侵犯了开发人员数据; 2、由于第一个原因,就导致umi 提供的路由重定向这个功能,对于开发人员来说不可靠,因为参数会被删除,不敢放心使用。也进一步减少了umi 路由重定向功能的价值; 3、这一条会主观一点,我之前的开发框架是angular,angular 中路由的每一个参数的控制权都在开发人员手里,并不会因为重定向而删除用户数据。这倒不是说angular 就一定对,但是从路由重定向这个功能而言,我认为angular 更加合理,umi 可以借鉴一下。 |
希望能保留 query && hash 的场景: |
我也认为应当保留参数,跳转时清空参数是为了解决什么问题呢? |
同意,或者给一个参数用来开关也行呀,我不想创造没用的组件来干这个事 |
1 similar comment
同意,或者给一个参数用来开关也行呀,我不想创造没用的组件来干这个事 |
|
What happens?
在路由的跳转过程中,如果是经过了redirect 匹配,查询参数会被删除。
How To Reproduce
路由配置
在路由
/two
下,通过history.push('/one?name=123')
跳转,跳转后的路由是/one?name=123
。属于期望结果。通过
history.push('/?name=123')
跳转,经过redirect,跳转的路由是/one
。查询参数name=123
被删除。不属于期望结果。最小复现repo
https://github.com/cxb1021/umi_redirect_reproduce.git
期望结果:
无论路由通过哪种方式跳转,查询参数都应该保留。
The text was updated successfully, but these errors were encountered: