]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs(cn): translate `Global injections within guards` section
authoryionr <yionr99@gmail.com>
Sun, 24 Dec 2023 03:45:22 +0000 (11:45 +0800)
committerGitHub <noreply@github.com>
Sun, 24 Dec 2023 03:45:22 +0000 (11:45 +0800)
packages/docs/zh/guide/advanced/navigation-guards.md

index 625e1d7e721f8a50fcef02e1ff422b0c8a39adbb..9818e8073c3ad21ea896b98b85564ff58557e09b 100644 (file)
@@ -136,9 +136,9 @@ router.afterEach((to, from, failure) => {
 
 <!-- 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