From 79cc227464e8d696b9dfa7f80689936020905ec5 Mon Sep 17 00:00:00 2001 From: Yuchao Wu Date: Wed, 31 Jul 2024 22:13:58 +1000 Subject: [PATCH] feat(VPullToRefresh): add disabled prop fixes #20242 --- .../vuetify/src/labs/VPullToRefresh/VPullToRefresh.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/vuetify/src/labs/VPullToRefresh/VPullToRefresh.tsx b/packages/vuetify/src/labs/VPullToRefresh/VPullToRefresh.tsx index 0d85b0a8908..fbcb303acff 100644 --- a/packages/vuetify/src/labs/VPullToRefresh/VPullToRefresh.tsx +++ b/packages/vuetify/src/labs/VPullToRefresh/VPullToRefresh.tsx @@ -22,6 +22,7 @@ export const VPullToRefresh = genericComponent()({ name: 'VPullToRefresh', props: { + disabled: Boolean, pullDownThreshold: { type: Number, default: 64, @@ -47,13 +48,13 @@ export const VPullToRefresh = genericComponent()({ const topOffset = computed(() => clamp(touchDiff.value, 0, props.pullDownThreshold)) function onTouchstart (e: TouchEvent | MouseEvent) { - if (refreshing.value) return + if (refreshing.value || props.disabled) return touching.value = true touchstartY = 'clientY' in e ? e.clientY : e.touches[0].clientY } function onTouchmove (e: TouchEvent | MouseEvent) { - if (refreshing.value || !touching.value) return + if (refreshing.value || !touching.value || props.disabled) return const touchY = 'clientY' in e ? e.clientY : e.touches[0].clientY @@ -63,7 +64,7 @@ export const VPullToRefresh = genericComponent()({ } function onTouchend (e: TouchEvent | MouseEvent) { - if (refreshing.value) return + if (refreshing.value || props.disabled) return touching.value = false if (canRefresh.value) { function done () {