1.新建页面
ionic g page forget
 
2.mode.html文件
<ion-item>
<ion-input clearInput [(ngModel)]='code' placeholder='请输入验证码'></ion-input>
<button clear ion-button class="i" item-end (tap)="getCode()" [disabled]="!verifyCode.disable">
{{verifyCode.verifyCodeTips}}
</button>
</ion-item>

要点:[disabled]="!verifyCode.disable" 为true时才会允许点击

 

3.demo.ts文件

import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular'; @Component({
selector: 'page-forget',
templateUrl: 'forget.html',
})
export class ForgetPage { codeParam = {
fromflag: 2,
usertel: "130123123"
}
constructor(
public navCtrl: NavController,
public navParams: NavParams, } ionViewDidLoad() {
console.log('ionViewDidLoad RegisterpasswordPage');
}
// 验证码倒计时
verifyCode: any = {
verifyCodeTips: "获取验证码",
countdown: 60,
disable: true
}
// 倒计时
settime() {
if (this.verifyCode.countdown == 1) {
this.verifyCode.countdown = 60;
this.verifyCode.verifyCodeTips = "获取验证码";
this.verifyCode.disable = true;
return;
} else {
this.verifyCode.countdown--;
} this.verifyCode.verifyCodeTips = "重新获取(" + this.verifyCode.countdown + ")";
setTimeout(() => {
this.verifyCode.verifyCodeTips = "重新获取(" + this.verifyCode.countdown + ")";
this.settime();
}, 1000);
}
getCode() {
if (this.codeParam.usertel == '') {
console.debug("请填写手机号!");
return;
}
else{
let alert = this.alertCtrl.create({
title: '提示',
subTitle: '验证码发送成功,请注意查收!',
buttons: ['确定']
});
alert.present(); //发送验证码成功后开始倒计时 this.verifyCode.disable = false;
this.settime();
}
}

最新文章

  1. jade模板引擎
  2. 6.能够使HTML和PHP分离开使用的模板
  3. C#获取本机的MAC地址
  4. SWIFT Button的基本用法
  5. Hibernate注解方法使用总结
  6. c基础语法
  7. python中函数的默认参数陷阱问题
  8. JavaScript 面向对象(一)
  9. shell 多进程
  10. 扩展js,实现c#中的string.format方便拼接字符串
  11. 解析 .Net Core 注入 (1) 注册服务
  12. css:a:visited限制
  13. c++ Qt向PHP接口POST文件流
  14. 我是这样理解HTTP和HTTPS区别的
  15. jQuery中$.ajax()方法参数解析
  16. web.xml详细选项配置
  17. mass种子模块看完了
  18. http://vjudge.net/contest/view.action?cid=51142#problem/C 精度转换的一道题。。。
  19. Windows桌面.exe程序安装、卸载、升级测试用例
  20. Scala--映射和元组

热门文章

  1. SVN 操作报错 “Previous operation has not finished; run &#39;cleanup&#39; if it was interrupted“
  2. Knowledge Point 20180303 我们为什么要配置环境变量
  3. Oracle 体系结构二 内存结构
  4. ESP8266 wifi干扰钓鱼实现
  5. 『ACM C++』 Codeforces | 1066A - Points in Segments
  6. 简单的mongo小工具 python
  7. MySQL数据库修改数据表类型(引擎)的方法
  8. Jquery中绑定事件与普通事件的区别
  9. Apache 错误:httpd: Could not open configuration file
  10. django_ORM学生管理系统