Within Nuxt.js, when working with the code in pages/posts/_id.vue
, it looks like this:
<template>
<div>
Post id: {{$route.params.id }}
</div>
</template>
If I enter the URL: http://localhost:3000/posts/123
, it will show Post id: 123.
While I have learned how to pass one parameter through the URL, my goal now is to also include the post's category and display a message similar to: Post id: 123. Category: News.
- How can I organize the posts folder to achieve the desired outcome?
- Furthermore, how do I access the URL to display something like
http://localhost:3000/posts/123
/News` ?