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

BUG move the sort When there is only one component in the container

Open shenzhirong opened this issue 9 years ago • 12 comments

Uncaught TypeError: Cannot read property 'map' of undefined method:function computeVmIndex(vnodes, element) { return vnodes.map(elt => elt.elm).indexOf(element) }

shenzhirong avatar Jun 21 '17 06:06 shenzhirong

jsfidle? scenario?

David-Desmaisons avatar Jun 21 '17 11:06 David-Desmaisons

BUG Bescription : There are two containers A and B, there is a content in B, no in B, drag the contents from A to B when the mouse button does not release and move in the B container, this will trigger the method : function computeVmIndex(vnodes, element) { return vnodes.map(elt => elt.elm).indexOf(element) }

shenzhirong avatar Jun 22 '17 01:06 shenzhirong

Hello @shenzhirong , please provide a jsfiddle. Thanks

David-Desmaisons avatar Jun 22 '17 02:06 David-Desmaisons

example path: https://github.com/David-Desmaisons/draggable-example
The example does not change, just setting the container B with height and width and borders xxx

shenzhirong avatar Jun 22 '17 03:06 shenzhirong

yes, i found this limitation too in my project. i think that until b lie in the box that has a bigger size than b itselft in a, b can drop in a correctly, or error will be trriggled!!!!

7greenfrog7 avatar Jun 22 '17 05:06 7greenfrog7

Hello, I am not able to reproduce: version 2.13.1:

vudraggable

David-Desmaisons avatar Jun 22 '17 13:06 David-Desmaisons

I use the version is also 2.13.1 。

You need to set the css first : .list-group { min-height: 20px; height: 500px; width:200px; border: 1px solid red; }

Then you only need to drag the contents of container A to container B, dragged into the container B up and down the mouse

shenzhirong avatar Jun 23 '17 06:06 shenzhirong

OK. got it. It is linked to the use of the move prop in this demo application. So If you don't need onMove, remove it as a quick bypass. I will provide a fix later.

David-Desmaisons avatar Jun 23 '17 11:06 David-Desmaisons

thanks . If you fix this bug please tell me

shenzhirong avatar Jun 24 '17 01:06 shenzhirong

@shenzhirong I will provide a corrected version probably with week-end

David-Desmaisons avatar Jun 24 '17 01:06 David-Desmaisons

@shenzhirong It is fixed in version v2.14.0

David-Desmaisons avatar Jun 24 '17 13:06 David-Desmaisons

I have a related issue I think. I can drop elements on the draggable container just fine. However, if there is one element in the container when the component loads, for example, one item in the cart, if I try to drag another one, the element gets pushed to the first index. Then as soon as I try to drag either of the two elements, I get a Cannot read property 'element' of null error.

To summarize....

Draggable works as expected unless it is loaded with one item. If there are multiple items, draggable works fine.

If there is one component in the container when the component is loaded, and I remove it, then try to drag a new item onto it, I get the same error. So you can narrow it down to "Draggable acts funny when loaded with one item."

I'll try to create a repo to reproduce soon.

jseger avatar Mar 02 '18 20:03 jseger