Fix Vue 3 directives

This commit is contained in:
N-Pex 2025-05-09 14:50:02 +02:00
parent ce81fdc91e
commit 2e46a0b663

View file

@ -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);