Fix Vue 3 directives
This commit is contained in:
parent
ce81fdc91e
commit
2e46a0b663
1 changed files with 3 additions and 3 deletions
|
|
@ -64,7 +64,7 @@ app.use((instance) => {
|
||||||
|
|
||||||
// Register a global custom directive called `v-blur` that prevents focus
|
// Register a global custom directive called `v-blur` that prevents focus
|
||||||
app.directive('blur', {
|
app.directive('blur', {
|
||||||
inserted: function (el) {
|
mounted: function (el) {
|
||||||
el.onfocus = (ev) => ev.target.blur()
|
el.onfocus = (ev) => ev.target.blur()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -77,7 +77,7 @@ app.directive('blur', {
|
||||||
* Like this: v-linkTap:500="[tapped,longTapped]"
|
* Like this: v-linkTap:500="[tapped,longTapped]"
|
||||||
*/
|
*/
|
||||||
app.directive('longTap', {
|
app.directive('longTap', {
|
||||||
bind: function (el, binding, ignoredvnode) {
|
beforeMount: function (el, binding, ignoredvnode) {
|
||||||
el.longTapTimeout = parseInt(binding.arg || "500");
|
el.longTapTimeout = parseInt(binding.arg || "500");
|
||||||
el.longTapCallbacks = binding.value;
|
el.longTapCallbacks = binding.value;
|
||||||
for (var i = el.longTapCallbacks.length; i < 2; i++) {
|
for (var i = el.longTapCallbacks.length; i < 2; i++) {
|
||||||
|
|
@ -157,7 +157,7 @@ app.directive('longTap', {
|
||||||
el.addEventListener("mouseup", touchEnd);
|
el.addEventListener("mouseup", touchEnd);
|
||||||
el.addEventListener("mousemove", touchMove);
|
el.addEventListener("mousemove", touchMove);
|
||||||
},
|
},
|
||||||
unbind: function (el) {
|
unmounted: function (el) {
|
||||||
el.longTapTimer && clearTimeout(el.longTapTimer);
|
el.longTapTimer && clearTimeout(el.longTapTimer);
|
||||||
el.removeEventListener("touchstart", el.longTapTouchStart);
|
el.removeEventListener("touchstart", el.longTapTouchStart);
|
||||||
el.removeEventListener("touchend", el.longTapTouchEnd);
|
el.removeEventListener("touchend", el.longTapTouchEnd);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue