]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: incorrect description of content in the dynamic-routing section (#2413)
authorstonelee <stonelee2048@gmail.com>
Thu, 5 Dec 2024 08:53:04 +0000 (16:53 +0800)
committerGitHub <noreply@github.com>
Thu, 5 Dec 2024 08:53:04 +0000 (09:53 +0100)
packages/docs/guide/advanced/dynamic-routing.md
packages/docs/zh/guide/advanced/dynamic-routing.md

index 5488b2fa3bf8f229f08dc770991a216848f4978a..6e5179bc3839cc1fc3bb2ee3caa2986c008697e3 100644 (file)
@@ -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.
 
index ba7b602d361065798137eace9cda49549beff972..543c43a79e43db7434ca7a460b8e20cc88b66eb7 100644 (file)
@@ -50,7 +50,7 @@ router.beforeEach(to => {
 })
 ```
 
-上面的例子有两个假设:第一,新添加的路由记录将与 `to` 位置相匹配,实际上导致与我们试图访问的位置不同。第二,`hasNecessaryRoute()` 在添加新的路由后返回 `false`,以避免无限重定向。
+上面的例子有两个假设:第一,新添加的路由记录将与 `to` 位置相匹配,实际上导致与我们试图访问的位置不同。第二,`hasNecessaryRoute()` 在添加新的路由后返回 `true`,以避免无限重定向。
 
 因为是在重定向中,所以我们是在替换将要跳转的导航,实际上行为就像之前的例子一样。而在实际场景中,添加路由的行为更有可能发生在导航守卫之外,例如,当一个视图组件挂载时,它会注册新的路由。