@@ -31,9 +31,9 @@ const Progress = {
3131 } ,
3232
3333 percent : {
34- index : 0 , total : 0 , text : '' ,
34+ index : null , total : null , text : '' ,
3535 toString ( percent ) {
36- if ( this . total ) return percent = Math . ceil ( this . index * 100 ) / this . total , Progress . option . index = '(' + this . index + '/' + this . total + ')' , [ Progress . option . index , ( Progress . option . percent = parseInt ( percent <= 100 ? percent >= 0 ? percent : 0 : 100 , 10 ) + '%' , Progress . option . percent ) , this . text ] . filter ( t => t !== '' ) . join ( ' ' + Progress . option . dash + ' ' )
36+ if ( this . index !== null && this . total !== null ) return percent = Math . ceil ( this . index * 100 ) / this . total , Progress . option . index = '(' + this . index + '/' + this . total + ')' , [ Progress . option . index , ( Progress . option . percent = parseInt ( percent <= 100 ? percent >= 0 ? percent : 0 : 100 , 10 ) + '%' , Progress . option . percent ) , this . text ] . filter ( t => t !== '' ) . join ( ' ' + Progress . option . dash + ' ' )
3737 return this . text !== '' ? ' ' + Progress . option . dash + ' ' + this . text . toString ( ) : ''
3838 } ,
3939 appendTo ( lines ) {
@@ -57,7 +57,7 @@ const Progress = {
5757 } ,
5858 stop ( ) {
5959 if ( Progress . timer === null ) return Progress
60- else return Progress . print ( Progress . clean + Progress . percent . appendTo ( Progress . lines ) + "\n" ) , clearInterval ( Progress . timer ) , Progress . lines = [ ] , Progress . percent . index = 0 , Progress . percent . total = 0 , Progress . percent . text = '' , Progress . option . $ . loading . _index = 0 , Progress . finish ( ) , Progress . finish = null , Progress . timer = null , Progress
60+ else return Progress . print ( Progress . clean + Progress . percent . appendTo ( Progress . lines ) + "\n" ) , clearInterval ( Progress . timer ) , Progress . lines = [ ] , Progress . percent . index = null , Progress . percent . total = null , Progress . percent . text = '' , Progress . option . $ . loading . _index = 0 , Progress . finish ( ) , Progress . finish = null , Progress . timer = null , Progress
6161 } ,
6262 done ( message = '完成' ) {
6363 return Progress . percent . index = Progress . percent . total , Progress . option . done = message , Progress . percent . text = Progress . option . done , Progress . stop ( Progress . finish = _ => { } ) , Progress
0 commit comments