Skip to content

Commit

Permalink
docs: incorrect description of content in the dynamic-routing section (
Browse files Browse the repository at this point in the history
  • Loading branch information
stonelee2048 authored Dec 5, 2024
1 parent 2370820 commit aad0d48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/docs/guide/advanced/dynamic-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ router.beforeEach(to => {
})
```

The example above assumes two things: first, the newly added route record will match the `to` location, effectively resulting in a different location from the one we were trying to access. Second, `hasNecessaryRoute()` returns `false` after adding the new route to avoid an infinite redirection.
The example above assumes two things: first, the newly added route record will match the `to` location, effectively resulting in a different location from the one we were trying to access. Second, `hasNecessaryRoute()` returns `true` after adding the new route to avoid an infinite redirection.

Because we are redirecting, we are replacing the ongoing navigation, effectively behaving like the example shown before. In real world scenarios, adding is more likely to happen outside of navigation guards, e.g. when a view component mounts, it register new routes.

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/zh/guide/advanced/dynamic-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ router.beforeEach(to => {
})
```

上面的例子有两个假设:第一,新添加的路由记录将与 `to` 位置相匹配,实际上导致与我们试图访问的位置不同。第二,`hasNecessaryRoute()` 在添加新的路由后返回 `false`,以避免无限重定向。
上面的例子有两个假设:第一,新添加的路由记录将与 `to` 位置相匹配,实际上导致与我们试图访问的位置不同。第二,`hasNecessaryRoute()` 在添加新的路由后返回 `true`,以避免无限重定向。

因为是在重定向中,所以我们是在替换将要跳转的导航,实际上行为就像之前的例子一样。而在实际场景中,添加路由的行为更有可能发生在导航守卫之外,例如,当一个视图组件挂载时,它会注册新的路由。

Expand Down

0 comments on commit aad0d48

Please # to comment.