You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
update function, why do I delete the node and then insert the node, and I find that these two lines of code, when executed, move the dom of sortablejs back, the actual effective code is moveArrayElement function.
So, are these two lines of code useless?
The text was updated successfully, but these errors were encountered:
Hello, thank you for your question. Here is our response:
In the onUpdate function, I performed deletion and insertion operations on the dom element and then used moveArrayElement. The reason for this is that I needed to delete and insert the dom element to trigger the animation effect. Simply moving the array element would not trigger the animation effect when updating the page.
I have already made the necessary modifications to this code in the latest version. Thank you.
file:useDraggable.ts
/**
*/
function onUpdate(evt: DraggableEvent) {
const { from, item, oldIndex, newIndex } = evt
removeNode(item) //146
insertNodeAt(from, item, oldIndex!) //147
moveArrayElement(unref(list), oldIndex!, newIndex!)
}
update function, why do I delete the node and then insert the node, and I find that these two lines of code, when executed, move the dom of sortablejs back, the actual effective code is moveArrayElement function.
So, are these two lines of code useless?
The text was updated successfully, but these errors were encountered: