app.routes.ts 952 B

1234567891011121314151617181920212223242526
  1. import { Routes,RouterModule } from '@angular/router';
  2. import { PostPageComponent } from './post-page/post-page.component'; // 导入 PostPage 组件
  3. import { CommunityPage } from './community/community.page';
  4. import { SharePageComponent } from './share-page/share-page.component';
  5. import { NgModule } from '@angular/core';
  6. export const routes: Routes = [
  7. {
  8. path: '',
  9. loadChildren: () => import('./tabs/tabs.routes').then((m) => m.routes),
  10. },
  11. {
  12. path: 'community',
  13. loadComponent: () => import('./community/community.page').then( m => m.CommunityPage)
  14. },
  15. { path: '', redirectTo: 'community', pathMatch: 'full' },
  16. { path: 'community', component: CommunityPage },
  17. { path: 'post-page/:id', component: PostPageComponent }, // 动态详情页面的路由
  18. { path: 'share', component: SharePageComponent },
  19. ];
  20. @NgModule({
  21. imports: [RouterModule.forRoot(routes)],
  22. exports: [RouterModule]
  23. })
  24. export class AppRoutingModule { }