import { NgModule } from '@angular/core'; import { mapToCanActivate, RouterModule, Routes } from '@angular/router'; import { AnthorhomeComponent } from './anthorhome/anthorhome.component'; import { AuthGuard } from './auth.guard'; import { HomeComponent } from './home/home.component'; import { LiveReviewComponent } from './live-review/live-review.component'; import { MyComponent } from './my/my.component'; import { NoticeComponent } from './notice/notice.component'; import { RankingComponent } from './ranking/ranking.component'; import { SpaceComponent } from './space/space.component'; const routes: Routes = [ { path: '', redirectTo:'home', pathMatch: "full", }, { path: 'home', //首页 canActivate: mapToCanActivate([AuthGuard]), component: HomeComponent, }, { path: 'anthirhome', //主播端首页 canActivate: mapToCanActivate([AuthGuard]), component: AnthorhomeComponent, }, { path: 'notice', //消息 component: NoticeComponent, }, { path: 'live-review', //预览直播 component: LiveReviewComponent, }, { path: 'ranking', //排名 component: RankingComponent, }, { path: 'my', //我的 component: MyComponent, }, { path: 'space', //朋友圈 component: SpaceComponent, }, ] @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule], }) export class TabsRoutingModule { }