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 (#9920)
This commit is contained in:
parent
580c9cd2f9
commit
3b6f14e57b
@ -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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user