From 308dd49c688cea21a132d41acfc11e52a936eae7 Mon Sep 17 00:00:00 2001 From: jimczj Date: Wed, 6 Mar 2019 20:00:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(tabs):=20=E5=8F=82=E6=95=B0=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/tabs/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/tabs/index.js b/src/components/tabs/index.js index a070a0012..50cb3fb4a 100644 --- a/src/components/tabs/index.js +++ b/src/components/tabs/index.js @@ -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 () { @@ -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) }