I have a flexible component that requires a unique api call each time it is used.
I am looking for a way to achieve something similar to the following:
const routes = [
{
path: '/books',
component: () => import('./Pages/Book-highlights/Nav/index.js'),
props: {api: '/api/allBooks'}
}
]
const router = new VueRouter({
routes
})
It seems that the props
property is specifically for utilizing URL parameters like ?api=something
. I would like to implement something like this:
<Nav api='/api/allBooks'></Nav>
Essentially, passing the api
through the VueRouter
.
Although my research suggests it cannot be done, I have a nagging feeling that I have come across a solution somewhere before!