Ben Lin
2024-08-22 c9f779c19d920efcca14fd17bbcca8254f92790d
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);