1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| const routers = [{ path: '/', meta: { title: '后台登录' }, component: (resolve) => require(['./views/login.vue'], resolve) //这个resolve原来是懒加载的意思. 不是一次性加载组件,访问哪个加载哪个 }, { path: '/main', meta: { title: '后台管理中心' //这个是title标题 }, component: (resolve) => require(['./views/main.vue'], resolve), //这就是子页面了 children: [ { path: '/', //当一开始进入页面转到子页面,避免空页面 //redirect: '/main/sub1' //指定路径 redirect:{ name: 'goods' } //指定命名路径 }, { path: 'sub1', component: (resolve) => require(['./views/sub1.vue'], resolve), name:'sub1' }, { path: 'sub2', component: (resolve) => require(['./views/sub2.vue'], resolve), name:'sub2' }, { path: 'sub3', component: (resolve) => require(['./views/sub3.vue'], resolve), name:'sub3' }, ]
}];
|