Skip to content

Commit

Permalink
fix: remove Math.abs
Browse files Browse the repository at this point in the history
  • Loading branch information
limichange authored Aug 30, 2018
1 parent d0facb0 commit a2d6717
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/tabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ class AtTabs extends AtComponent {

const { current } = this.props
const touchMove = e.touches[0].pageX
const moveDistance = Math.abs(touchMove - this.touchDot)
const moveDistance = touchMove - this.touchDot

if (!this.isMoving && this.time < 10 && moveDistance >= 40) {
if (!this.isMoving && this.time < 10) {
// 向左滑动
if (current + 1 < this.maxIndex) {
if (current + 1 < this.maxIndex && moveDistance <= -40) {
this.isMoving = true
this.handleClick(current + 1)

// 向右滑动
} else if (current - 1 >= 0) {
} else if (current - 1 >= 0 && moveDistance >= 40) {
this.isMoving = true
this.handleClick(current - 1)
}
Expand Down

0 comments on commit a2d6717

Please sign in to comment.