_famcoo

导航

 
 1   const routes = [
 2   {
 3     path: '/',
 4     name: '导航一',
 5     component: Main,
 6     children: [
 7       {
 8         path: '/pageOne',
 9         name: '选项一',
10         component: PageOne
11       },
12       {
13         path: '/pageTwo',
14         name: '选项二',
15         component: PageTwo
16       }
17     ]
18   }

Main.vue 中的代码在 App.vue 中定义的 <router-view/> 中渲染!!

pageOne.vue,pageTwo.vue 的代码在 Main.vue 中定义的 <router-view/> 中渲染!!

如果还有子路由,那么子路由中的代码会在父路由中的 <router-view/> 中渲染!!

posted on 2020-08-03 18:59  famcoo  阅读(298)  评论(0编辑  收藏  举报