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) {
53
53
54
54
const CLONE_ELEMENT_KEY = Symbol ( 'cloneElement' )
55
55
56
- interface DraggableEvent extends SortableEvent {
56
+ interface DraggableEvent < T = any > extends SortableEvent {
57
57
item : HTMLElement & { [ CLONE_ELEMENT_KEY ] : any }
58
+ data : T
59
+ clonedData : T
58
60
}
59
61
type SortableMethod = 'closest' | 'save' | 'toArray' | 'destroy' | 'option'
60
62
@@ -131,7 +133,11 @@ export function useDraggable<T>(...args: any[]): UseDraggableReturn {
131
133
* @param {DraggableEvent } evt - DraggableEvent
132
134
*/
133
135
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
135
141
}
136
142
137
143
/**
You can’t perform that action at this time.
0 commit comments