@@ -35,6 +35,7 @@ function Transition (el, id, hooks, vm) {
35
35
this . op =
36
36
this . cb = null
37
37
this . justEntered = false
38
+ this . entered = this . left = false
38
39
this . typeCache = { }
39
40
// bind
40
41
var self = this
@@ -77,7 +78,11 @@ p.enter = function (op, cb) {
77
78
this . cb = cb
78
79
addClass ( this . el , this . enterClass )
79
80
op ( )
81
+ this . entered = false
80
82
this . callHookWithCb ( 'enter' )
83
+ if ( this . entered ) {
84
+ return // user called done synchronously.
85
+ }
81
86
this . cancel = this . hooks && this . hooks . enterCancelled
82
87
queue . push ( this . enterNextTick )
83
88
}
@@ -115,6 +120,7 @@ p.enterNextTick = function () {
115
120
*/
116
121
117
122
p . enterDone = function ( ) {
123
+ this . entered = true
118
124
this . cancel = this . pendingJsCb = null
119
125
removeClass ( this . el , this . enterClass )
120
126
this . callHook ( 'afterEnter' )
@@ -148,7 +154,11 @@ p.leave = function (op, cb) {
148
154
this . op = op
149
155
this . cb = cb
150
156
addClass ( this . el , this . leaveClass )
157
+ this . left = false
151
158
this . callHookWithCb ( 'leave' )
159
+ if ( this . left ) {
160
+ return // user called done synchronously.
161
+ }
152
162
this . cancel = this . hooks && this . hooks . leaveCancelled
153
163
// only need to handle leaveDone if
154
164
// 1. the transition is already done (synchronously called
@@ -187,6 +197,7 @@ p.leaveNextTick = function () {
187
197
*/
188
198
189
199
p . leaveDone = function ( ) {
200
+ this . left = true
190
201
this . cancel = this . pendingJsCb = null
191
202
this . op ( )
192
203
removeClass ( this . el , this . leaveClass )
0 commit comments