File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,17 @@ if (!dragula) {
4
4
throw new Error ( '[vue-dragula] cannot locate dragula.' )
5
5
}
6
6
7
+ const raf = window . requestAnimationFrame
8
+ const waitForTransition = raf
9
+ ? function ( fn ) {
10
+ raf ( ( ) => {
11
+ raf ( fn )
12
+ } )
13
+ }
14
+ : function ( fn ) {
15
+ window . setTimeout ( fn , 50 )
16
+ }
17
+
7
18
class DragulaService {
8
19
constructor ( Vue ) {
9
20
this . bags = [ ] // bag store
@@ -87,7 +98,9 @@ class DragulaService {
87
98
let dropElmModel = notCopy ? sourceModel [ dragIndex ] : JSON . parse ( JSON . stringify ( sourceModel [ dragIndex ] ) )
88
99
89
100
if ( notCopy ) {
90
- sourceModel . splice ( dragIndex , 1 )
101
+ waitForTransition ( ( ) => {
102
+ sourceModel . splice ( dragIndex , 1 )
103
+ } )
91
104
}
92
105
targetModel . splice ( dropIndex , 0 , dropElmModel )
93
106
drake . cancel ( true )
Original file line number Diff line number Diff line change @@ -43,6 +43,12 @@ export default function (Vue) {
43
43
update ( newValue , oldValue ) {
44
44
if ( ! newValue ) { return }
45
45
46
+ const bagName = this . params . bag
47
+ if ( bagName !== undefined && bagName . length !== 0 ) {
48
+ name = bagName
49
+ }
50
+ const bag = service . find ( name )
51
+ drake = bag . drake
46
52
if ( ! drake . models ) {
47
53
drake . models = [ ]
48
54
}
You can’t perform that action at this time.
0 commit comments