I have a Vue component that has a prop named \'title\' e.g:
The vue-router docs clearly state params
only work with name
and not path
.
// set props: true in your route definition
const userId = 123
router.push({ name: 'user', params: { userId }}) // -> /user/123
// This will NOT work
router.push({ path: '/user', params: { userId }}) // -> /user
If you use path
, pass the params in the path itself or use query
as demonstrated below:
router.push({ path: `/user/${userId}` }) // -> /user/123
// with query, resulting in /register?plan=private
router.push({ path: 'register', query: { plan: 'private' }})