Skip to content

Commit 26c0f16

Browse files
committed
edit docs
1 parent 16d5598 commit 26c0f16

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

docs/en/advanced/navigation-guards.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Every guard function receives three arguments:
4040

4141
> New in 2.5.0
4242
43-
In 2.5.0+ you can register a global guard with `router.onResolve`. This is similar to `router.beforeEach`, with the difference that resolve guards will be called right before the navigation is confirmed, **after all in-component guards and async route components are resolved**.
43+
In 2.5.0+ you can register a global guard with `router.beforeResolve`. This is similar to `router.beforeEach`, with the difference that resolve guards will be called right before the navigation is confirmed, **after all in-component guards and async route components are resolved**.
4444

4545
### Global After Hooks
4646

@@ -118,7 +118,7 @@ beforeRouteEnter (to, from, next) {
118118

119119
You can directly access `this` inside `beforeRouteLeave`. The leave guard is usually used to prevent the user from accidentally leaving the route with unsaved edits. The navigation can be canceled by calling `next(false)`.
120120

121-
### The Full Guard Resolution Flow
121+
### The Full Navigation Resolution Flow
122122

123123
1. Navigation triggered
124124
2. Call leave guards in deactivated components

docs/en/essentials/dynamic-matching.md

+12
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ const User = {
5353
}
5454
```
5555

56+
Or, use the `beforeRouteUpdate` guard introduced in 2.2:
57+
58+
``` js
59+
const User = {
60+
template: '...',
61+
beforeRouteUpdate (to, from, next) {
62+
// react to route changes...
63+
// don't forget to call next()
64+
}
65+
}
66+
```
67+
5668
### Advanced Matching Patterns
5769

5870
`vue-router` uses [path-to-regexp](https://github.com/pillarjs/path-to-regexp) as its path matching engine, so it supports many advanced matching patterns such as optional dynamic segments, zero or more / one or more requirements, and even custom regex patterns. Check out its [documentation](https://github.com/pillarjs/path-to-regexp#parameters) for these advanced patterns, and [this example](https://github.com/vuejs/vue-router/blob/dev/examples/route-matching/app.js) of using them in `vue-router`.

0 commit comments

Comments
 (0)