Task request path rendering xxx.com/index/news, xxx.com/index/User For this effect, I set the file tree to:
pages/ --| index/ -----| News/ -------| index.vue -----| User/ -------| index.vue --| index.vue
But I cannot successfully jump to other pages except the root directory.
What do I need to do to make the path of the web page display the desired effect?
The
home page (located in the root path) can safely be named
index.vue
, there is no other way to bind the page to the/
path.But the problem is indeedYou cannot have a page and a folder with the same name at the same time. They will overlap.
The solution could be to use a custom route in
nuxt.config.js
to map the root path/
to your homepage:See
nuxt.config.js/router
DocumentationNote: You can also delete the automatically created
/home
route from here, it will be in theroutes
array.