Vue · Junior · Question 46 of 75
How do you read the :id param of the route /users/:id in <script setup>?
- ✓Correct answer:
const route = useRoute();thenroute.params.id - 2
this.$params.id - 3
window.location.params.id
Explanation
useRoute() returns the reactive current route (params, query, hash). useRouter() returns the router instance for navigation.