Skip to content

Commit 6ba8682

Browse files
committed
docs(params): use strigs in params examples
1 parent 519bb4f commit 6ba8682

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Diff for: docs/guide/essentials/navigation.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,34 @@ To navigate to a different URL, use `router.push`. This method pushes a new entr
1414

1515
This is the method called internally when you click a `<router-link>`, so clicking `<router-link :to="...">` is the equivalent of calling `router.push(...)`.
1616

17-
| Declarative | Programmatic |
18-
|-------------|--------------|
17+
| Declarative | Programmatic |
18+
| ------------------------- | ------------------ |
1919
| `<router-link :to="...">` | `router.push(...)` |
2020

2121
The argument can be a string path, or a location descriptor object. Examples:
2222

23-
``` js
23+
```js
2424
// literal string path
2525
router.push('home')
2626

2727
// object
2828
router.push({ path: 'home' })
2929

3030
// named route
31-
router.push({ name: 'user', params: { userId: 123 }})
31+
router.push({ name: 'user', params: { userId: '123' } })
3232

3333
// with query, resulting in /register?plan=private
34-
router.push({ path: 'register', query: { plan: 'private' }})
34+
router.push({ path: 'register', query: { plan: 'private' } })
3535
```
3636

3737
**Note**: `params` are ignored if a `path` is provided, which is not the case for `query`, as shown in the example above. Instead, you need to provide the `name` of the route or manually specify the whole `path` with any parameter:
3838

3939
```js
40-
const userId = 123
41-
router.push({ name: 'user', params: { userId }}) // -> /user/123
40+
const userId = '123'
41+
router.push({ name: 'user', params: { userId } }) // -> /user/123
4242
router.push({ path: `/user/${userId}` }) // -> /user/123
4343
// This will NOT work
44-
router.push({ path: '/user', params: { userId }}) // -> /user
44+
router.push({ path: '/user', params: { userId } }) // -> /user
4545
```
4646

4747
The same rules apply for the `to` property of the `router-link` component.
@@ -54,8 +54,8 @@ In 2.2.0+, optionally provide `onComplete` and `onAbort` callbacks to `router.pu
5454

5555
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.
5656

57-
| Declarative | Programmatic |
58-
|-------------|--------------|
57+
| Declarative | Programmatic |
58+
| --------------------------------- | --------------------- |
5959
| `<router-link :to="..." replace>` | `router.replace(...)` |
6060

6161
## `router.go(n)`
@@ -64,7 +64,7 @@ This method takes a single integer as parameter that indicates by how many steps
6464

6565
Examples
6666

67-
``` js
67+
```js
6868
// go forward by one record, the same as history.forward()
6969
router.go(1)
7070

0 commit comments

Comments
 (0)