]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs(cn): translate `Global injections within guards` section into Chinese (#2090)
authoryionr <yionr99@gmail.com>
Wed, 27 Dec 2023 13:20:17 +0000 (21:20 +0800)
committerGitHub <noreply@github.com>
Wed, 27 Dec 2023 13:20:17 +0000 (21:20 +0800)
* docs(cn): translate `Global injections within guards` section

* Update navigation-guards.md

* chore: update checkpoint

* Revert "chore: update checkpoint"

This reverts commit 8aa9cf74941bd6a5cfdb2a9451a8826355ad66ba.

* remove TODO comment

* Update packages/docs/zh/guide/advanced/navigation-guards.md

Co-authored-by: Jinjiang <zhaojinjiang@me.com>
---------

Co-authored-by: Jinjiang <zhaojinjiang@me.com>
packages/docs/zh/guide/advanced/navigation-guards.md

index 625e1d7e721f8a50fcef02e1ff422b0c8a39adbb..7952384c352b1138c7d64408be2a9da853811c8c 100644 (file)
@@ -134,11 +134,10 @@ router.afterEach((to, from, failure) => {
 
 了解更多关于 navigation failures 的信息在[它的指南](./navigation-failures.md)中。
 
-<!-- TODO: translation -->
 
-## Global injections within guards
+## 在守卫内的全局注入
 
-Since Vue 3.3, it is possible to use `inject()` within navigation guards. This is useful for injecting global properties like the [pinia stores](https://pinia.vuejs.org). Anything that is provided with `app.provide()` is also accessible within `router.beforeEach()`, `router.beforeResolve()`, `router.afterEach()`:
+从 Vue 3.3 开始,你可以在导航守卫内使用 `inject()` 方法。这在注入像 [pinia stores](https://pinia.vuejs.org) 这样的全局属性时很有用。在 `app.provide()` 中提供的所有内容都可以在 `router.beforeEach()`、`router.beforeResolve()`、`router.afterEach()` 内获取到:
 
 ```ts
 // main.ts