中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
输入验证码页面,倒计时结束后显示重新发送,点击重新发送无法控制倒计时控件再次显示 当前困难影响:体验不好
微信扫码分享
@Entry @Component struct Page { @State elapsedTime: number = 0; textTimerController: TextTimerController = new TextTimerController() build() { Column() { Row() { TextTimer({ isCountDown: true, count: 59000, controller: this.textTimerController }) .format("ss") .fontColor($r("app.color.theme_color_m")) .onTimer((utc: number, elapsedTime: number) => { this.elapsedTime = elapsedTime }) Text($r("app.string.login")) .fontSize(15) .fontColor($r("app.color.theme_color_m")) .onClick(() => { this.textTimerController.start() }) } .margin({ top: 25 }) .visibility(this.elapsedTime == 59000 ? Visibility.None : Visibility.Visible) Button('重置后启动') .onClick(() => { this.textTimerController.reset() this.textTimerController.start() }) Text() { Span('1111111111111') .fontColor($r("app.color.theme_color_m")) Span('2222222222222') .fontColor($r("app.color.theme_color_m")) .onClick(() => { this.textTimerController.reset() this.textTimerController.start() }) } // .visibility(this.elapsedTime == 59000 ? Visibility.Visible : Visibility.None) .textAlign(TextAlign.Center) .fontSize(13) .margin({ top: 25 }) .width("90%") } .width('100%') .height('100%') } }