ionic2-Alert弹出框 原

2019-04-04 16:04:59 浏览数 (1)

代码语言:javascript复制
下面为函数Alert 弹出框的ts
import {Component} from '@angular/core';
import {NavController,LoadingController,AlertController} from 'ionic-angular';

@Component({
  templateUrl: 'build/pages/contact/contact.html'
})
export class ContactPage {
	public user={
       username : '',
       userpassword :'',

	}
  constructor(private navCtrl: NavController, private loadingCtrl: LoadingController, private alertCtrl: AlertController) {
  	this.navCtrl=navCtrl;
  }
  showFill(){

  	alert(this.user.username);
  	console.log(this.user.userpassword);
    if(this.user.username==""){
    	let alert = this.alertCtrl.create({
    		title: 'Low battery',
    		subTitle: '10% of battery remaining',
    		buttons: ['确定']
	  });
	  alert.present();
    	} else{
	  	 let loading = this.loadingCtrl.create({
	      content: 'Please wait...'
	    });
 
    loading.present();
      setTimeout(() => {
      loading.dismiss();
    }, 5000);
}
  }
}

(adsbygoogle = window.adsbygoogle || []).push({});

0 人点赞