1

By default, nuxt adds a route for each page in pages.

I want to make when going to the page e.g. project.local/id/ec29cjsa5fas512ik, the user goes to a page template and the Vue receives this ec29cjsa5fas512ik id from the url so it can make proper API calls later.

2
  • Something like this? stackoverflow.com/a/67490633/8816585 Nuxt's dynamic route + accessing this.$route.params. Commented Nov 21, 2022 at 12:24
  • 1
    Exactly! Nuxt's dynamic routes allows to make /page/:id thing with just an underscore in the beggining. Thanks Commented Nov 21, 2022 at 12:30

1 Answer 1

2

You can make a dynamic page in Nuxt2 with the following file, eg.

/pages/details/_id.vue

then you'll have a path like /details/:id.


More info can be found here: https://nuxtjs.org/docs/features/file-system-routing#dynamic-routes

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.