Skip to content

Commit

Permalink
fix(swiper): 滑动会触发onClick问题修复 (#1182)
Browse files Browse the repository at this point in the history
* fix(swiper): 滑动会触发onClick问题修复

fix #1169

* refactor(swiper): useSwipe 删除threshold参数
  • Loading branch information
hkaikai committed Dec 21, 2023
1 parent e791806 commit 1013bbd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/swiper/swiper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
height: containerHeight,
}"
@transitionend.self="handleAnimationEnd"
@click="onItemClick"
>
<slot />
</div>
Expand Down Expand Up @@ -63,9 +64,9 @@ import {
watch,
onUnmounted,
} from 'vue';
import { useSwipe } from '@vueuse/core';
import isObject from 'lodash/isObject';
import isNumber from 'lodash/isNumber';
import { useSwipe } from '../swipe-cell/useSwipe';
import config from '../config';
import SwiperProps from './props';
Expand Down Expand Up @@ -181,10 +182,8 @@ const processIndex = (index: number, source: SwiperChangeSource) => {
};
const { lengthX, lengthY } = useSwipe(swiperContainer, {
passive: false,
onSwipeStart() {
if (disabled.value || isSwiperDisabled.value || !items.value.length) return;
onItemClick(); // use touchstart to simulate click on swipe start
stopAutoplay();
},
onSwipe(e: TouchEvent) {
Expand Down

0 comments on commit 1013bbd

Please sign in to comment.