File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,10 @@ function tryOnMounted(fn: Fn) {
5353
5454const CLONE_ELEMENT_KEY = Symbol ( 'cloneElement' )
5555
56- interface DraggableEvent extends SortableEvent {
56+ interface DraggableEvent < T = any > extends SortableEvent {
5757 item : HTMLElement & { [ CLONE_ELEMENT_KEY ] : any }
58+ data : T
59+ clonedData : T
5860}
5961type SortableMethod = 'closest' | 'save' | 'toArray' | 'destroy' | 'option'
6062
@@ -131,7 +133,11 @@ export function useDraggable<T>(...args: any[]): UseDraggableReturn {
131133 * @param {DraggableEvent } evt - DraggableEvent
132134 */
133135 function onStart ( evt : DraggableEvent ) {
134- evt . item [ CLONE_ELEMENT_KEY ] = clone ( unref ( unref ( list ) ?. [ evt . oldIndex ! ] ) )
136+ const data = unref ( unref ( list ) ?. [ evt . oldIndex ! ] )
137+ const clonedData = clone ( data )
138+ evt . data = data
139+ evt . clonedData = clonedData
140+ evt . item [ CLONE_ELEMENT_KEY ] = clonedData
135141 }
136142
137143 /**
You can’t perform that action at this time.
0 commit comments