anish2690 / vue-draggable-next

Vue 3 drag-and-drop component
https://vue-draggable-next.vercel.app
MIT License
504 stars 44 forks source link

Deep clone is not working #41

Closed asadullakkh closed 1 year ago

asadullakkh commented 1 year ago

I am trying to deep clone the dragged object with nested childs, but it is not working. When I change the dragged element's value, it mutates the original object. And all Draggable elements' value are being same after changing the dragged element.

 <VueDraggableNext
      class="dragArea list-group"
      :list="blocks"
      :group="{ name: 'people', pull: 'clone', put: false }"
      :sort="false"
      :clone="clone"
    >
 </VueDraggableNext>

function clone(e) {
  return JSON.parse(JSON.stringify(e));
}

"vue-draggable-next": "^2.1.1",