app.module.ts 977 B

123456789101112131415161718192021222324252627282930
  1. import { NgModule } from '@angular/core';
  2. import { BrowserModule } from '@angular/platform-browser';
  3. import { AppRoutingModule } from './app-routing.module';
  4. import { RouterModule, Routes } from '@angular/router'; // 导入 RouterModule 和 Routes
  5. import { AppComponent } from './app.component';
  6. import { HomeComponent } from 'src/modules/craftsmart/home/home.component';
  7. import { PageCartComponent } from 'src/modules/craftsmart/page-cart/page-cart.component';
  8. import { PageMineComponent } from 'src/modules/craftsmart/page-mine/page-mine.component';
  9. const routes: Routes = [
  10. { path: 'home', component: HomeComponent },
  11. { path: 'cart', component: PageCartComponent },
  12. { path: 'mine', component: PageMineComponent },
  13. ];
  14. @NgModule({
  15. declarations: [
  16. AppComponent
  17. ],
  18. imports: [
  19. BrowserModule,
  20. AppRoutingModule,
  21. RouterModule.forRoot(routes) // 在这里配置根路由
  22. ],
  23. providers: [],
  24. bootstrap: [AppComponent]
  25. })
  26. export class AppModule { }