Looking to extract a number from a route parameter :
routes: [{ path: '/user/:id', component: User }]
Wanting to access the prop within the User
component:
export default {
props: {
id: Number
}
}
Encountering an error message:
Invalid prop: type check failed for prop "id". Expected Number with value 2, got
String with value "2".
Is there a way to automatically convert the value to a number? I explored https://github.com/posva/vue-coerce-props but believe I can achieve the same without using another extension.