feat: add routeRedirect function redirect to relative url instead of route definition redirectTo #291
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修复缺陷:#288
使用 routeRedirect 函数传递相对路由地址,即可在组件中跳转路由,跳转时设置 replaceUrl 为 true,不在 URL 中生成当前组件的路由地址。
这个主要是因为如下的方案定义路由时, Angular 不会在 Location 中新增一个 state,所以如果单个应用这样处理点击回退时不会有 app1 的地址的。
但是微前端下就不行,app1 应用不会在 Location 加 state,但是其他应用会加,这就导致回退的时候变成了 app1,需要回退两次。
解决方案就是手动通过代码的方式跳转