Skip to content

Commit

Permalink
fix(tabs): 参数调整
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczj committed Mar 6, 2019
1 parent caaf219 commit 308dd49
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/tabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { uuid, isTest } from '../../common/utils'
import AtComponent from '../../common/component'

const ENV = Taro.getEnv()
const MIN_DISTANCE = 100
const MAX_INTERVAL = 10

export default class AtTabs extends AtComponent {
constructor () {
Expand Down Expand Up @@ -83,14 +85,14 @@ export default class AtTabs extends AtComponent {
const moveDistance = touchMove - this._touchDot
const maxIndex = tabList.length

if (!this._isMoving && this._interval < 10) {
if (!this._isMoving && this._interval < MAX_INTERVAL) {
// 向左滑动
if (current + 1 < maxIndex && moveDistance <= -40) {
if (current + 1 < maxIndex && moveDistance <= -MIN_DISTANCE) {
this._isMoving = true
this.handleClick(current + 1)

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

0 comments on commit 308dd49

Please sign in to comment.