想要在访问/tab的时候默认展示 /tab/home
使用了重定向 但是重定向后 路径是对的但是页面是空的,
重定向到和/tab 平级的路由没有问题,重定向到子路由就不行, 这个该如何配置?
{
path: '/tab',
component: '@/layouts/tabbar',
routes: [
{ exact: true, title: '首页', path: '/tab/home', component: '@/pages/home' },
{ exact: true, title: '我的', path: '/tab/mine', component: '@/pages/mine' },
],
}
配置子路由时这样子写
{pathname === "/tab" ? <Home/> : props.children}