One interesting feature of NuxtJS is the ability to assign routes in a specific way.
For instance, by naming a file pages/_book.vue
, we can access the route localhost:3000/my-book
with the parameter params.book
set to "my-book".
But what if some books are nested deep within multiple directories? We want to capture the entire route in the params.book
variable, with each directory separated by "/". So, a route like
localhost:3000/finance/strategies/experts
should result in params.book
being "finance/strategies/experts".
Is there a way to achieve this functionality?
It's important to note that the directory structure may be complex and unknown, making it impossible to create static structures like pages/_book/_type/_level.vue
.