Redirect 如何重定向到第一个子组件vue路由器
我在做Vue路由器。我有个问题。当我在父组件Redirect 如何重定向到第一个子组件vue路由器,redirect,vue.js,vue-router,Redirect,Vue.js,Vue Router,我在做Vue路由器。我有个问题。当我在父组件(设置)中访问时,我不想重定向到第一个子组件(设置配置文件) 预期url:localhost:8080/settings-->localhost:8080/settings/profile 这是我的路由器: { name: 'settings', path: '/settings', component: () => import('./views/settings.vue'), children: [ {
(设置)
中访问时,我不想重定向到第一个子组件(设置配置文件)
预期url:localhost:8080/settings
-->localhost:8080/settings/profile
这是我的路由器:
{
name: 'settings',
path: '/settings',
component: () => import('./views/settings.vue'),
children: [
{
path: 'profile',
name: 'SettingProfile',
component: () => import('./components/settings/profile.vue')
},
{
path: 'account',
name: 'account',
component: () => import('./components/settings/account.vue')
}
]
},
您可以添加重定向配置,如:
{ path: '/settings', redirect: '/profile' }
也可以使用名称来完成。有关更多信息,请参阅。哦,greate。这是我的错误,我是如何忽略这一部分的文件。谢谢你的帮助。很高兴帮助你!它必须是儿童路线本身吗?在我的情况下,它不是重定向。唯一适合我的(但只有在我刷新页面时)是{path:'',name:'my redirect'}作为子路由