]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: params
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 20 Jun 2023 14:49:44 +0000 (16:49 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 20 Jun 2023 14:49:44 +0000 (16:49 +0200)
packages/docs/guide/essentials/navigation.md
packages/router/__tests__/router.spec.ts

index 14ab4a24c7ef48c1a9e16c0b742ffc713f18ff6f..acb7fa36cda0dcd42c2a8be3e7dee1026d19ed68 100644 (file)
@@ -56,7 +56,7 @@ router.push({ name: 'user', params: { username } }) // -> /user/eduardo
 router.push({ path: '/user', params: { username } }) // -> /user
 ```
 
-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.
+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.
 
 Since the prop `to` accepts the same kind of object as `router.push`, the exact same rules apply to both of them.
 
@@ -70,7 +70,7 @@ It acts like `router.push`, the only difference is that it navigates without pus
 | --------------------------------- | --------------------- |
 | `<router-link :to="..." replace>` | `router.replace(...)` |
 
-It's also possible to directly add a property `replace: true` to the `routeLocation` that is passed to `router.push`:
+It's also possible to directly add a property `replace: true` to the `to` argument that is passed to `router.push`:
 
 ```js
 router.push({ path: '/home', replace: true })
index 235002f24c95773c64257a96eb16346bb526b545..a60db5393ebfda912ee00f4d0d99d2e495f93d44 100644 (file)
@@ -319,7 +319,7 @@ describe('Router', () => {
     await router.push({ name: 'optional', params: {} })
   })
 
-  it('removes null/undefined params when current location has it', async () => {
+  it('removes null/undefined optional params when current location has it', async () => {
     const { router } = await newRouter()
 
     await router.push({ name: 'optional', params: { p: 'a' } })
@@ -331,7 +331,7 @@ describe('Router', () => {
     expect(router.currentRoute.value.params).toEqual({})
   })
 
-  it('keeps empty strings', async () => {
+  it('keeps empty strings in optional params', async () => {
     const { router } = await newRouter()
     const route1 = router.resolve({ name: 'optional', params: { p: '' } })
     expect(route1.params).toEqual({ p: '' })