useDraggable will trigger a click event after each drag and drop completion
3261564019 opened this issue · comments
陈露超 commented
Describe the bug
how to retain click events while retaining drag and drop functionality
Reproduction
no
System Info
no
Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
Haibo 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
}
}