Skip to content

Commit b5ce47f

Browse files
committed
update docs
1 parent 1a6113f commit b5ce47f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

docs/en/api/router-instance.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
Add global navigation guards. See [Navigation Guards](../advanced/navigation-guards.md).
2929

3030

31-
- **router.push(location)**
32-
- **router.replace(location)**
31+
- **router.push(location, onComplete?, onAbort?)**
32+
- **router.replace(location, onComplete?, onAbort?)**
3333
- **router.go(n)**
3434
- **router.back()**
3535
- **router.forward()**
@@ -64,4 +64,6 @@
6464

6565
> 2.2.0+
6666
67-
Queue a callback to be called when the router has completed the initial navigation. This is useful when you need to wait until all asynchronous route enter hooks / async components have been resolved, e.g. in server-side rendering.
67+
This method queues a callback to be called when the router has completed the initial navigation, which means it has resolved all async enter hooks and async components that are associated with the initial route.
68+
69+
This is useful in server-side rendering to ensure consistent output on both the server and the client.

docs/en/essentials/navigation.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Aside from using `<router-link>` to create anchor tags for declarative navigation, we can do this programmatically using the router's instance methods.
44

5-
#### `router.push(location)`
5+
#### `router.push(location, onComplete?, onAbort?)`
66

77
To navigate to a different URL, use `router.push`. This method pushes a new entry into the history stack, so when the user clicks the browser back button they will be taken to the previous URL.
88

@@ -28,7 +28,9 @@ router.push({ name: 'user', params: { userId: 123 }})
2828
router.push({ path: 'register', query: { plan: 'private' }})
2929
```
3030

31-
#### `router.replace(location)`
31+
In 2.2.0+, optionally provide `onComplete` and `onAbort` callbacks to `router.push` or `router.replace` as the 2nd and 3rd arguments. These callbacks will be called when the navigation either successfully completed (after all async hooks are resolved), or aborted (navigated to the same route, or to a different route before current navigation has finished), respectively.
32+
33+
#### `router.replace(location, onComplete?, onAbort?)`
3234

3335
It acts like `router.push`, the only difference is that it navigates without pushing a new history entry, as its name suggests - it replaces the current entry.
3436

0 commit comments

Comments
 (0)