const routes = [ { name: 'home', path: '/', component: Home, meta: { title: '首页' }, redirect: '/welcome', children: [ { name: 'welcome', path: '/welcome', meta: { title: '欢迎页' }, component: () => import('./../views/Welcome.vue'), }, { name: 'user', path: 'user', meta: { title: '用户管理' }, component: () => import('./../views/Welcome.vue'), children: [ { name: 'info', path: 'info', meta: { title: '信息统计' }, component: () => import('./../views/Welcome.vue'), }, ] }, ] }, { name: 'login', path: '/login', component: () => import('./../views/Login.vue'), meta: { title: '登录' }, } ]
子路由中的path不能加"/"不然路径会变成绝对路径 如 www.xxx.com/info
如果想要 www.xxx.com/user/info 千万不能加"/"