重定向作用:如果访问a地址将跳转到b地址
应用场景:如果访问其他页面,在未登录的情况下,跳转到登录页面
const routers = [
//重定向
{
path:'/',
name:'fatherPage',
compoent:fatherPage,
redirect:'/index',
//目标路由
children:[{
path:'/index',
name:'index',
conpoent:index
}]
}
]
如上例:当访问/的时候会通过关键字redirect重定向至index,并由下面的目标路由表明重定向目标路由的具体信息