amendx / vue-dndrop

:herb: A vue library for drag and drop :sparkles:
https://amendx.github.io/vue-dndrop
MIT License
207 stars 21 forks source link

Refreshing an array #53

Open yvahava opened 2 years ago

yvahava commented 2 years ago

Hi. When I init the array for the first time, the drag and drop seems to work fine. However, when I refresh the array a second time, the drag and drop no longer works well. Viewing it within the 'onDrop', I can see that the dropElement has 'addedIndex' of null.

amendx commented 2 years ago

Hi @yvahava can you record what weird behaviour you're experiencing? How are you refreshing the array?

Here on this example, you can see that after @drop the element fires:
image

yvahava commented 2 years ago

I have an array resultsData that is part of the v-for loop as you see below. I simply reassign the array to a new array object.

    <Container @drop="onDrop(resultsData, $event)" :should-accept-drop="shouldAcceptDrop">
      <Draggable
        v-for="(elementData, index) in resultsData"
        :key="headerData.id + index + '_stdElements'"
      >