import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { RouteReuseStrategy, RouterModule } from '@angular/router'; import { IonicModule } from '@ionic/angular'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { IonicRouteStrategy } from '@ionic/angular'; @NgModule({ declarations: [AppComponent], imports: [ BrowserModule, IonicModule.forRoot(), RouterModule, // 确保导入 RouterModuler AppRoutingModule, ], providers: [ { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, // ...其他服务提供者 ], bootstrap: [AppComponent], }) export class AppModule {}