我有几个组件。这是路线文件
routes: [
{ path: '/members/logout', name: 'logout', component: Logout, meta: { pageTitle: 'Logout' } },
{ path: '/members/contact', name: 'contact', component: Contact, meta: {pageTitle: 'Contact'} },
{ path: '/', name: 'offline', component: LoggedOut, meta: {pageTitle: 'Logged Out'}, children: [
{ path: 'members/login', name: 'login' component: Authenticate, meta: {pageTitle: 'Authenticate'} },
{ path: 'members/signup', name: 'signup', component: Signup, meta: {pageTitle: 'Signup'} },
{ path: 'members/confirm', name: 'not-confirmed', component: NotConfirmed, meta: {pageTitle: 'NotConfirmed'} },
{ path: 'connect/callback', name: 'connect', component: Connect, meta: {pageTitle: 'Connect'} }
]}
]
在页面加载时,我先检查用户是否已登录。如果有,我会显示Login组件,如果没有 - 注册。一切正常,但我想要别的东西。
当我最初访问domain.com时,我不希望链接切换到/ members / login或/ members / signup,只有当用户按下网站内的链接时才会这样做。我希望路由保持domain.com并在登录或注册之间显示相应的组件。
我尝试使用别名,但仅适用于一个