import { Component , ViewChild , ElementRef , Input , SimpleChanges , ChangeDetectorRef } from '@angular/core' ; import { Brightness } from '@ionic-native/brightness/ngx' ; @ Component ( { selector : 'b-progressbar' , templateUrl : './b-progressbar.component.html' , styleUrls : [ './b-progressbar.component.scss' ] , } ) export class BProgressbarComponent { bar ; @ Input ( ) value = 0 ; @ Input ( ) text = '正在下载更新...' ; showDone = false ; get value100 ( ) { return parseInt ( ( this . value * 100 ) . toString ( ) ) ; } @ ViewChild ( 'ProgressBar' , { read : ElementRef , static : true } ) progressBar : ElementRef ; constructor ( private brightness ) { } ngOnInit ( ) { this . brightness . setKeepScreenOn ( true ) ; } ngOnDestroy ( ) { this . brightness . setKeepScreenOn ( false ) ; } ngAfterViewInit ( ) { } update ( ) { } }