Skip to content

Commit b480bd1

Browse files
committed
docs: params
1 parent e6dfcde commit b480bd1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ router.push({ name: 'user', params: { username } }) // -> /user/eduardo
5656
router.push({ path: '/user', params: { username } }) // -> /user
5757
```
5858

59-
When specifying `params`, make sure to either provide a `string` or `number` (or an array of these for [repeatable params](./route-matching-syntax.md#repeatable-params)). **Any other type (like `undefined`, `false`, etc) will be automatically stringified**. For [optional params](./route-matching-syntax.md#optional-parameters), you can provide an empty string (`""`) as the value to skip it.
59+
When specifying `params`, make sure to either provide a `string` or `number` (or an array of these for [repeatable params](./route-matching-syntax.md#repeatable-params)). **Any other type (like objects, booleans, etc) will be automatically stringified**. For [optional params](./route-matching-syntax.md#optional-parameters), you can provide an empty string (`""`) or `null` as the value to remove it.
6060

6161
Since the prop `to` accepts the same kind of object as `router.push`, the exact same rules apply to both of them.
6262

@@ -70,7 +70,7 @@ It acts like `router.push`, the only difference is that it navigates without pus
7070
| --------------------------------- | --------------------- |
7171
| `<router-link :to="..." replace>` | `router.replace(...)` |
7272

73-
It's also possible to directly add a property `replace: true` to the `routeLocation` that is passed to `router.push`:
73+
It's also possible to directly add a property `replace: true` to the `to` argument that is passed to `router.push`:
7474

7575
```js
7676
router.push({ path: '/home', replace: true })

Diff for: packages/router/__tests__/router.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('Router', () => {
319319
await router.push({ name: 'optional', params: {} })
320320
})
321321

322-
it('removes null/undefined params when current location has it', async () => {
322+
it('removes null/undefined optional params when current location has it', async () => {
323323
const { router } = await newRouter()
324324

325325
await router.push({ name: 'optional', params: { p: 'a' } })
@@ -331,7 +331,7 @@ describe('Router', () => {
331331
expect(router.currentRoute.value.params).toEqual({})
332332
})
333333

334-
it('keeps empty strings', async () => {
334+
it('keeps empty strings in optional params', async () => {
335335
const { router } = await newRouter()
336336
const route1 = router.resolve({ name: 'optional', params: { p: '' } })
337337
expect(route1.params).toEqual({ p: '' })

0 commit comments

Comments
 (0)