Skip to content

Commit 46b3b28

Browse files
committed
Fix Code.
1 parent f60562e commit 46b3b28

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)