From 2e46a0b6637ee6639b0a3e452684b25a31b27504 Mon Sep 17 00:00:00 2001 From: N-Pex Date: Fri, 9 May 2025 14:50:02 +0200 Subject: [PATCH] Fix Vue 3 directives --- src/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index d8632fe..6b8434c 100644 --- a/src/main.js +++ b/src/main.js @@ -64,7 +64,7 @@ app.use((instance) => { // Register a global custom directive called `v-blur` that prevents focus app.directive('blur', { - inserted: function (el) { + mounted: function (el) { el.onfocus = (ev) => ev.target.blur() } }); @@ -77,7 +77,7 @@ app.directive('blur', { * Like this: v-linkTap:500="[tapped,longTapped]" */ app.directive('longTap', { - bind: function (el, binding, ignoredvnode) { + beforeMount: function (el, binding, ignoredvnode) { el.longTapTimeout = parseInt(binding.arg || "500"); el.longTapCallbacks = binding.value; for (var i = el.longTapCallbacks.length; i < 2; i++) { @@ -157,7 +157,7 @@ app.directive('longTap', { el.addEventListener("mouseup", touchEnd); el.addEventListener("mousemove", touchMove); }, - unbind: function (el) { + unmounted: function (el) { el.longTapTimer && clearTimeout(el.longTapTimer); el.removeEventListener("touchstart", el.longTapTouchStart); el.removeEventListener("touchend", el.longTapTouchEnd);