mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 01:54:48 +00:00
fix(Swipe): should prevent touchmove event when swiping (#9920)
This commit is contained in:
@@ -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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user