Skip to content

Commit

Permalink
fix(module: date-picker): fix NAN bug when fast scroll (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
BronzeCui authored and fisherspy committed Sep 18, 2019
1 parent 26a07d7 commit 3e63d20
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/date-picker/date-picker.component.ts
Expand Up @@ -596,7 +596,7 @@ export class DatePickerComponent implements OnInit, OnDestroy, AfterViewInit {
if (this.resultArr.length < 3) {
this.resultArr.push('1');
}
result = this.resultArr
result = this.resultArr.slice(0, 3)
.map(v => {
return this.preZero(parseInt(v, 0));
})
Expand Down Expand Up @@ -719,8 +719,9 @@ export class DatePickerComponent implements OnInit, OnDestroy, AfterViewInit {
this.current_time[realIdx] = -targetLong / this.lineHeight;
this.resultArr[checkIdx] = -targetLong / this.lineHeight;
} else {
this.current_time[realIdx] = -targetLong / this.lineHeight + 1;
this.resultArr[checkIdx] = -targetLong / this.lineHeight + 1;
const delta = this.current_time[0] === this.min_date[0] ? this.min_date[realIdx] : 1;
this.current_time[realIdx] = -targetLong / this.lineHeight + delta;
this.resultArr[checkIdx] = -targetLong / this.lineHeight + delta;
}

this.data[checkIdx] = arr;
Expand Down

0 comments on commit 3e63d20

Please sign in to comment.