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