Answer the question
In order to leave comments, you need to log in
How to display different pages in one dynamic route?
I can’t find something in the documentation of information on how to display different pages in one dynamic route. I have a dynamic _slug.vue file in the pages/ folder. I would like that when requesting mydomen.ru/something, either the article page or the profile page is displayed. I don’t have categories, and accordingly I don’t want to make a request like this mydomen.ru/profile/Dmitry or mydomen.ru/post/privet . How can this be implemented in nuxt? I found only one way out. Use component and make a request to the server and look for a match there throughout the database. And if it is found, then display the corresponding component. But for this it is necessary for each object (I use json ) to have a flag to which type it belongs. Either this is a profile or articles. But it doesn't seem very efficient to me. I would like advice. Thank you.
Answer the question
In order to leave comments, you need to log in
Making two routes is not an option at all? And why?
/profile/:username
/post/:slug
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question