vue dynamic route push with params

Solutions on MaxInterview for vue dynamic route push with params by the best coders in the world

showing results for - "vue dynamic route push with params"
Oskar
11 Aug 2020
1// literal string path
2router.push('/users/eduardo')
3
4// object with path
5router.push({ path: '/users/eduardo' })
6
7// named route with params to let the router build the url
8router.push({ name: 'user', params: { username: 'eduardo' } })
9
10// with query, resulting in /register?plan=private
11router.push({ path: '/register', query: { plan: 'private' } })
12
13// with hash, resulting in /about#team
14router.push({ path: '/about', hash: '#team' })
15
Francesca
11 Mar 2016
1const userId = '123'
2router.push({ name: 'user', params: { userId } }) // -> /user/123
3router.push({ path: `/user/${userId}` }) // -> /user/123
4// This will NOT work
5router.push({ path: '/user', params: { userId } }) // -> /user
similar questions
queries leading to this page
vue dynamic route push with params