As a beginner in Vue, I have been exploring a demo project and struggling with understanding how routes with query parameters function. The documentation suggests using
router.push({ path: 'register', query: { plan: 'private' }})
to generate the URL /register?plan=private
.
I'm curious if it's possible to achieve similar functionality with nested routes.
My goal is to set the URL for the BookAppointment component as:
/physicians/?appt_id=12345&npi=123456789
. Any suggestions on a better approach would be greatly appreciated. Thank you!
router/index.js
const router = new VueRouter({
routes: [
{ path: '/physicians/', component: PhysicianLanding,
children: [
{
// PhysicianProfile
path: 'profile/:url',
component: PhysicianProfile
},
{
// BookAppointment has 3 different progress steps to get to
// the confirm page
path: '',
query: { appt_id: '12345', npi: '123456789'},
component: BookAppointment
}
]
}
]
})