Skip to content

Commit

Permalink
[bugfix] Swipe: add defensive code (#2253)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Dec 10, 2018
1 parent f1742ec commit eacabe8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/swipe/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,13 @@ export default create({
return;
}
swipes[0].offset = atLast && (delta < 0 || move > 0) ? trackSize : 0;
swipes[count - 1].offset =
atFirst && (delta > 0 || move < 0) ? -trackSize : 0;
if (swipes[0]) {
swipes[0].offset = atLast && (delta < 0 || move > 0) ? trackSize : 0;
}
if (swipes[count - 1]) {
swipes[count - 1].offset = atFirst && (delta > 0 || move < 0) ? -trackSize : 0;
}
if (move && active + move >= -1 && active + move <= count) {
this.active += move;
Expand Down

0 comments on commit eacabe8

Please sign in to comment.