Ben Lin
2024-06-18 ebbd788fbb2c0b45d4473798efc57eec8ba74a25
src/directives/repeatClick.ts
@@ -2,7 +2,7 @@
 * Prevent repeated clicks
 * @Example v-repeat-click="()=>{}"
 */
import { on, once } from '/@/utils/domUtils';
import { on, once } from '@/utils/domUtils';
import type { Directive, DirectiveBinding } from 'vue';
const repeatDirective: Directive = {
@@ -18,8 +18,8 @@
      interval = null;
    };
    on(el, 'mousedown', (e: MouseEvent): void => {
      if ((e as any).button !== 0) return;
    on(el, 'mousedown', (e: Event): void => {
      if ((e as MouseEvent).button !== 0) return;
      startTime = Date.now();
      once(document as any, 'mouseup', clear);
      interval && clearInterval(interval);