]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: note about params type
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 14 Jun 2021 14:06:09 +0000 (16:06 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 14 Jun 2021 14:06:09 +0000 (16:06 +0200)
Close #873

docs/guide/essentials/navigation.md

index ee2cc6c3b60ce5fbaae656b407dbdfaf05eb0984..31eefb146be9c80abd18a621ebc6cf57276c25e4 100644 (file)
@@ -51,6 +51,8 @@ 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](./oute-matching-syntax.md#repeatable-params)). **Any other type (like `undefined`, `false`, etc) will be automatically stringified**. For [optional params](./route-matching-syntax.md#repeatable-params), you can provide an empty string (`""`) as the value to skip it.
+
 Since the prop `to` accepts the same kind of object as `router.push`, the exact same rules apply to both of them.
 
 `router.push` and all the other navigation methods return a _Promise_ that allows us to wait til the navigation is finished and to know if it succeeded or failed. We will talk more about that in [Navigation Handling](../advanced/navigation-failures.md).