Why doesn't the path you put in the pages folder work?

1. I created a new folder pages in the src directory to store the components, and created two files in the pages folder: index.vue and content.vue

the code for configuring routing in 2.routes.js is as follows

{path:"/pages/index",name:"index",component:index},
{path:"/pages/content",name:"content",component:content}

part of the rendering code in 3.app.vue is as follows

< template >
< div id= "app" >

   <div>
  <router-link  to="/pages/index"></router-link>
  <router-link  to="/pages/content"></router-link>
</div>
<router-view></router-view>

< / div >
< / template >

according to the above configuration, the page is blank and there is no error. I don"t know where the road is mismatched.
I have tried to put the index.vue and content.vue files in the relationship with the app.vue level. Modify path:/index and path:/content, and change it to to= "/ index" in router-link.
so here I want to ask why the path you put in the pages folder doesn"t work?

Mar.05,2021

{path:'/pages/index',name:'index',component:index}, is the index component in your component referenced on the page? You need to reference this component before you can write it in component.

import Index from './index.vue'
{path:'/pages/index',name:'index',component:Index}
The path in

router is not a path, but a route, as long as it corresponds to it. The above elder brother is right. Your component:index, probably didn't get the index,. If there is no import, if the package is not wrong, just console to see what your index is.

Menu