[Vuejs]-Vue3 For-Loop with Computed Property triggers onDragEnd immediately

0๐Ÿ‘

โœ…

I think the issue lies in choosing to use the ondragstart event. When this is fired, the DOM is re-rendered to display your slots, which moves things around so that your mouse cursor is no longer over the element itself. dragend is then fired before the drag actually commenced. Change this simply to ondrag and it will work:

https://jsfiddle.net/m7ps3f40/

To debug and figure this out, I simplified your fiddle a lot. I felt the dragList computed and the :bind="getProps" used more code and is less readable than the a simpler approach of just using HTML elements and Vue-style events for dragging. You might find it interesting to take a look:

https://jsfiddle.net/o5pyhtd3/2/

but of course your fiddle might be a cut down version of a bigger piece of code, so perhaps you need to stick to your approach.

Leave a comment