3👍
No need for onMounted hook or async function here. You need to call the useRoute composable.
<script setup>
const route = useRoute();
console.log(route.params.applicant_id)
console.log(route.params.id)
</script>
0👍
The problem lies within the underscores (_
) used in your pages route name.
If you rename your page to exam-[id]-[applicant_id].vue
, the route params, when accessing /exam-cl96q0u040000v1ocg2ffryio-3
look like this:
{id: 'cl96q0u040000v1ocg2ffryio', applicant_id: '3'}
Source:stackexchange.com