Vue passing data from one page to the next
Solution 1:
params
is for path parameter.
If you have a route like this: /user/:id
You can do $router.push({ name: 'user', params: { id: 'abc123' })
and you can access the dynamic parameter's value via $route.params.id
(no r on the $route
).
If path parameter is not necessary, you can also just use query string:
router.push({ path: 'register', query: { plan: 'private' } })
It will result in: /register?plan=private
You can then access the value via $route.query.plan
Docs: https://router.vuejs.org/guide/essentials/navigation.html
Although honestly you can simply just do:
$router.push('/user/abc123')
or $router.push('/register?plan=private')