Skip to content

Commit 2c6b9d1

Browse files
committed
fix(indexes): 修复点击事件双重触发问题
1 parent e0781b4 commit 2c6b9d1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/uniapp-components/indexes/indexes.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export default {
7979
groupTop: [],
8080
sidebar: null,
8181
currentTouchAnchor: null,
82+
touchMoved: false,
8283
8384
dataCurrent: this.current,
8485
};
@@ -256,16 +257,22 @@ export default {
256257
},
257258
258259
onTouchMove(e) {
260+
this.touchMoved = true;
259261
this.onAnchorTouch(e);
260262
},
261263
262264
onTouchCancel() {
265+
this.touchMoved = false;
263266
this.toggleTips(false);
264267
},
265268
266269
onTouchEnd(e) {
270+
// 只有真正拖拽滑动过才走触摸定位,纯点击由 onClick 处理,避免双重触发导致抽搐
271+
if (this.touchMoved) {
272+
this.touchMoved = false;
273+
this.onAnchorTouch(e);
274+
}
267275
this.toggleTips(false);
268-
this.onAnchorTouch(e);
269276
},
270277
271278
onAnchorTouch: throttle(function (e) {

0 commit comments

Comments
 (0)