Pass custom data to `$router.push()` in vue-router
I found the solution. There is a Note in the Vue-router docs that says:
Note:
params
are ignored if apath
is provided ... Instead, you need to provide thename
So we are allowed to pass custom data to params
if we navigate using route's name
like so:
$router.push({name: 'next-page', params: {foo: 1}})
// in /next-page
$route.params.foo // 1