Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(swiper): 滑动会触发onClick问题修复 #1182

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading