Vue.Draggable
Vue.Draggable copied to clipboard
Incorrect display of the sheet after dragend
I implement changing the elements of the array during dragging using :move so that the order numbers change during movement, and not just at the end, but I have a problem with the display, if I change 9 and 1 element, then the order in the array by order will be correct, but in the browser the display 2 3 4 5 6 7 8 9 1
`onDragEnd() {
this.isDragging = false;
this.isChosen = false;
this.draggedIndex = -1;
this.myArray.sort((a, b) => a.order - b.order);
},
onMove(evt) {
const draggedIndex = this.draggedIndex;
const newIndex = evt.draggedContext.futureIndex;
const movedElements = this.myArray.splice(draggedIndex, 1);
this.myArray.splice(newIndex, 0, ...movedElements);
this.draggedIndex = newIndex;
for (let i = 0; i < this.myArray.length; i++) {
this.myArray[i].order = i + 1;
}
},`
@David-Desmaisons please can you help me?
if i try to display myList array in outside draggable my list shows by order correct, but not inside draggable, if i change oly two cars between alse works