1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-06 03:57:59 +08:00

fix(Swipe): should prevent touchmove event when swiping ()

This commit is contained in:
neverland 2021-11-24 09:49:30 +08:00 committed by GitHub
parent 580c9cd2f9
commit 3b6f14e57b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -290,8 +290,16 @@ export default defineComponent({
if (props.touchable && state.swiping) { if (props.touchable && state.swiping) {
touch.move(event); touch.move(event);
if (isCorrectDirection.value) { // if user starting to touchmove, prevent the event bubbling to
// avoid affecting the parent components
const shouldPrevent =
isCorrectDirection.value ||
touch.offsetY.value > touch.offsetX.value === props.vertical;
if (shouldPrevent) {
preventDefault(event, props.stopPropagation); preventDefault(event, props.stopPropagation);
}
if (isCorrectDirection.value) {
move({ offset: delta.value }); move({ offset: delta.value });
} }
} }