ionic3 Alert组件的使用方法

html页面

 <button ion-button color="danger" class="button-block button-round-ios" (click)="myAlert()">alert提示</button>

ts代码

import { Component } from '@angular/core';
import { AlertController } from 'ionic-angular';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController,public alertCtrl: AlertController,public toastCtrl: ToastController) {

  }


  myAlert(){
    let myalert=this.alertCtrl.create({});
      myalert.setTitle('项目分类列表');
      myalert.addButton('OK');
    myalert.present();
  }
 

}

 

posted @ 2019-02-28 15:04  Ai-Long  阅读(2260)  评论(0编辑  收藏  举报