@@ -65,6 +65,7 @@ class DatePickerItem extends Component<void, Props, State> {
6565 this . touchY = 0 ; // 保存touchstart的pageY
6666 this . translateY = 0 ; // 容器偏移的距离
6767 this . currentIndex = MIDDLE_INDEX ; // 滑动中当前日期的索引
68+ this . moveDateCount = 0 ; // 一次滑动移动了多少个时间
6869
6970 this . state = {
7071 translateY : MIDDLE_Y ,
@@ -180,9 +181,9 @@ class DatePickerItem extends Component<void, Props, State> {
180181 _moveToNext ( direction ) {
181182 const date = this . state . dates [ MIDDLE_INDEX ] ;
182183 const { max, min } = this . props ;
183- if ( direction === - 1 && date . getTime ( ) < min . getTime ( ) ) {
184+ if ( direction === - 1 && date . getTime ( ) < min . getTime ( ) && this . moveDateCount ) {
184185 this . _updateDates ( 1 ) ;
185- } else if ( direction === 1 && date . getTime ( ) > max . getTime ( ) ) {
186+ } else if ( direction === 1 && date . getTime ( ) > max . getTime ( ) && this . moveDateCount ) {
186187 this . _updateDates ( - 1 ) ;
187188 }
188189
@@ -220,6 +221,7 @@ class DatePickerItem extends Component<void, Props, State> {
220221 event . pageY ;
221222
222223 this . translateY = this . state . translateY ;
224+ this . moveDateCount = 0 ;
223225 }
224226
225227
@@ -244,6 +246,7 @@ class DatePickerItem extends Component<void, Props, State> {
244246
245247 // 检测是否更新日期列表
246248 if ( this . _checkIsUpdateDates ( direction , translateY ) ) {
249+ this . moveDateCount = direction > 0 ? this . moveDateCount + 1 : this . moveDateCount - 1 ;
247250 this . _updateDates ( direction ) ;
248251 }
249252
0 commit comments