From f047267cce349d3c204b05158b80b88ab12c47b9 Mon Sep 17 00:00:00 2001 From: Mikhailov Nikita Date: Wed, 6 Jul 2022 06:01:59 +0300 Subject: [PATCH] feat(onLongPress): added modifiers (#1719) --- packages/core/onLongPress/directive.ts | 2 +- packages/core/onLongPress/index.md | 20 +++++++++++-- packages/core/onLongPress/index.test.ts | 37 +++++++++++++++++++++++-- packages/core/onLongPress/index.ts | 31 +++++++++++++++++++-- 4 files changed, 81 insertions(+), 9 deletions(-) diff --git a/packages/core/onLongPress/directive.ts b/packages/core/onLongPress/directive.ts index f660f65d410..bb32d6c9cac 100644 --- a/packages/core/onLongPress/directive.ts +++ b/packages/core/onLongPress/directive.ts @@ -17,7 +17,7 @@ BindingValueFunction | BindingValueArray > = { [directiveHooks.mounted](el, binding) { if (typeof binding.value === 'function') - onLongPress(el, binding.value) + onLongPress(el, binding.value, { modifiers: binding.modifiers }) else onLongPress(el, ...binding.value) }, diff --git a/packages/core/onLongPress/index.md b/packages/core/onLongPress/index.md index 3b57efd0f11..0e0f316fccb 100644 --- a/packages/core/onLongPress/index.md +++ b/packages/core/onLongPress/index.md @@ -6,6 +6,13 @@ category: Sensors Listen for a long press on an element. +Function provides modifiers in options + * stop + * once + * prevent + * capture + * self + ## Usage ```html @@ -23,7 +30,11 @@ const resetHook = () => { longPressedHook.value = false } -onLongPress(htmlRefHook, onLongPressCallbackHook) +onLongPress( + htmlRefHook, + onLongPressCallbackHook, + { modifiers: { prevent: true } } +)