Vue.draggable: Nested component dragging with transition-group

Created on 13 Dec 2016  路  5Comments  路  Source: SortableJS/Vue.Draggable

When I drag an element across nested components inside a <transition-group> (so that I can have animated sorting), upon releasing the drag, it appears for a second in its old place before ending up in the drop target.
I made a fiddle for this: http://jsfiddle.net/bvjfa9xk/2/

Most helpful comment

I figured it out myself. You can just pass the animation time via options and don't use <transition-group>

<draggable v-model="items" :options="{ animation: 200 }">

All 5 comments

Hi @szmarci , this is the behaviour of transition-group used in conjunction with draggable.
An another option of transition is to use animation Sortable option.

Hi @David-Desmaisons , thanks for getting back to me. Yeah, I checked the animation property of sortable, but it was a little different. It already start animating while you were dragging it, whereas with transition-group it worked after you have dropped the item. Do you know a way of achieving this former behaviour with sortable's animation?

Also, I found another thing, I'm not sure if I should open a new issue or not, but here it is:
Based on this fiddle: http://jsfiddle.net/bvjfa9xk/2/
If you empty a sublist completely, you can no longer drag back elements to it. I assume it is normal behaviour, but is there a way to get around it?
Thanks!

For the second question, you can set a minheight on the div where you can drop element, so you can drop element when the collection is empty see jsfiddle examples for this.

For the animation, there migth be a way tuning sortbale animation, but I did not spend enought time to find it.

Hi @szmarci. Did you find a solution to create the same animation behavior as sortable has. I mean that the transition animation only happens once at the beginning.

I figured it out myself. You can just pass the animation time via options and don't use <transition-group>

<draggable v-model="items" :options="{ animation: 200 }">

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iou90 picture iou90  路  3Comments

ghost picture ghost  路  3Comments

AnnaStuehlmeyer picture AnnaStuehlmeyer  路  3Comments

Sualty picture Sualty  路  3Comments

rootman picture rootman  路  3Comments