Skip to content

Commit 866611f

Browse files
yionrJinjiang
andauthored
docs(cn): translate Global injections within guards section into Chinese (#2090)
* docs(cn): translate `Global injections within guards` section * Update navigation-guards.md * chore: update checkpoint * Revert "chore: update checkpoint" This reverts commit 8aa9cf7. * remove TODO comment * Update packages/docs/zh/guide/advanced/navigation-guards.md Co-authored-by: Jinjiang <[email protected]> --------- Co-authored-by: Jinjiang <[email protected]>
1 parent 3711c94 commit 866611f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,10 @@ router.afterEach((to, from, failure) => {
134134

135135
了解更多关于 navigation failures 的信息在[它的指南](./navigation-failures.md)中。
136136

137-
<!-- TODO: translation -->
138137

139-
## Global injections within guards
138+
## 在守卫内的全局注入
140139

141-
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()`:
140+
Vue 3.3 开始,你可以在导航守卫内使用 `inject()` 方法。这在注入像 [pinia stores](https://pinia.vuejs.org) 这样的全局属性时很有用。在 `app.provide()` 中提供的所有内容都可以在 `router.beforeEach()``router.beforeResolve()``router.afterEach()` 内获取到:
142141

143142
```ts
144143
// main.ts

0 commit comments

Comments
 (0)