community-routing.module.ts 1.3 KB

123456789101112131415161718192021
  1. import { NgModule } from '@angular/core';
  2. import { RouterModule, Routes } from '@angular/router';
  3. import { ShareComponent } from '../share/share.component';
  4. import { RecommendDetailComponent } from '../recommend-detail/recommend-detail.component';
  5. import { AttentionDetailComponent } from '../attention-detail/attention-detail.component';
  6. import { ScienceDetailComponent } from '../science-detail/science-detail.component';
  7. import { PageLessonDetailComponent } from '../page-lesson-detail/page-lesson-detail.component';
  8. const routes: Routes = [
  9.     { path: "share", component: ShareComponent }, // 当路径为 "share" 时,加载 ShareComponent 组件
  10.     { path: "recommend", component: RecommendDetailComponent }, // 当路径为 "recommend" 时,加载 RecommendDetailComponent 组件
  11.     { path: "attention", component: AttentionDetailComponent }, // 当路径为 "attention" 时,加载 AttentionDetailComponent 组件
  12.     { path: "science", component: ScienceDetailComponent }, // 当路径为 "science" 时,加载 ScienceDetailComponent 组件
  13.     { path: "lesson", component: PageLessonDetailComponent },
  14. ]
  15. @NgModule({
  16.     imports: [RouterModule.forChild(routes)], // 导入路由配置
  17.     exports: [RouterModule] // 导出路由模块
  18. })
  19. export class CommunityRoutingModule { }