vueuse / vueuse

Collection of essential Vue Composition Utilities for Vue 2 and 3

Home Page:https://vueuse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useDraggable will trigger a click event after each drag and drop completion

3261564019 opened this issue · comments

Describe the bug

how to retain click events while retaining drag and drop functionality

Reproduction

no

System Info

no

Used Package Manager

npm

Validations

commented

Can't find an elegant solution. There is a temporary approach.

const isDragging = ref(false);

useDraggable(dragger, {
  onMove: () => {
    isDragging.value = true;
  },
  onEnd: () => {
    setTimeout(() => {
      isDragging.value = false;
    }, 100);
  },
});

function onClick() {
  if (!isDragging.value) {
    // do sth
  }
}