Vue.Draggable icon indicating copy to clipboard operation
Vue.Draggable copied to clipboard

onMove event not firing up

Open H4D3SPH4NT0M opened this issue 3 years ago • 8 comments

I have a issue where the move event is not firing. my plan is to cancel the dragging as soon as the user puts the item in a wrong spot.

On the other hand the onStart and the onEnd are working, is it possible to return false in onEnd and cancel the dragging?

First draggable where the user starts dragging <draggable ghostClass="on-drag" @start="onStart" @end="onEnd" :options="{ animation: 300, group: 'bookingDrag', pull: true, push: true, sort: true, }" :move="onMove" @move="onMove" tag="tbody" group="bookingDrag" > <transition-group type="transition" name="flip-list" tag="tbody"> <b-card v-for="item in booking" :key="item.id" img-alt="Image" tag="article" :data-id="item.id" style="img" class="mb-2" > <b-card-text> Time: {{ item.startTime }}~{{ item.endTime }}<br />Name: {{ item.name }} <br /> {{ item.event }} </b-card-text> </b-card> </transition-group> </draggable>

end destenation of the b-card

<draggable @end="onEnd" @click="sort" :options="{ animation: 300, group: 'bookingDrag', pull: true, push: true, sort: true, }" :move="onMove" @move="onMove" group="bookingDrag" ghostClass="on-drag" tag="td" v-for="(time, j) of times" :ref="'slot-' + (j + i * times.length + 1)" :key="time.id" class="bg-light-gray" > </draggable>

H4D3SPH4NT0M avatar Mar 15 '22 11:03 H4D3SPH4NT0M

<draggable :move="onMove" />

marktohark avatar Apr 06 '22 09:04 marktohark

image

The onMove event seems to not be fired while dragging. What if I need the dragged element position (green arrow in the image)? How can I get a reference to the dragged element (and so to its position)?

aldo avatar Apr 07 '22 15:04 aldo

Hi! this is also happening to me, any news?

Luis0Antonio avatar Sep 29 '22 23:09 Luis0Antonio

Hi! this is also happening to me, any news?

I just gave up and build the whole thing myself, luckily HTML5 has a dragging API This will give you more freedom on how you want the interaction to happen between the elements. https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API

H4D3SPH4NT0M avatar Oct 11 '22 20:10 H4D3SPH4NT0M

Hi! this is also happening to me, - _ -

xiziliang avatar Aug 18 '23 07:08 xiziliang

Hi! this is also happening to me, - _ -

use :move="onMove", dont @move="onMove" :)

xiziliang avatar Aug 18 '23 07:08 xiziliang

I have an alternative solution, not use gap or other properties for the space between elements, but use padding and box-sizing: border-box; In this way, all the spaces belong to elements, :move can always be triggered.

Conpeter avatar Oct 09 '23 03:10 Conpeter