一、alert组件

  1. # tab2.page.html
  2. <ion-content>
  3. <ion-button color="primary" (click)="presentAlert()">Primary</ion-button>
  4. </ion-content>
  5. # tab2.page.ts
  6. export class Tab2Page {
  7. constructor(public alertController: AlertController) {}
  8. async presentAlert() {
  9. const alert = await this.alertController.create({
  10. header: 'Alert',
  11. subHeader: 'Subtitle',
  12. message: 'This is an alert message.',
  13. buttons: ['OK']
  14. });
  15. await alert.present();
  16. }
  17. }

二、修改工具栏颜色

  1. <ion-toolbar color="success">
  2. <ion-title>
  3. Tab One
  4. </ion-title>
  5. </ion-toolbar>

三、修改返回按钮文字

  1. //app.module.ts中配置
  2. @NgModule({
  3. ...
  4. imports: [IonicModule.forRoot({
  5. backButtonText:"返回"
  6. })],
  7. })
  8. export class AppModule {}