@@ -29,7 +29,7 @@ function Transition (el, id, hooks, vm) {
29
29
// async state
30
30
this . pendingCssEvent =
31
31
this . pendingCssCb =
32
- this . jsCancel =
32
+ this . cancel =
33
33
this . pendingJsCb =
34
34
this . op =
35
35
this . cb = null
@@ -76,6 +76,7 @@ p.enter = function (op, cb) {
76
76
addClass ( this . el , this . enterClass )
77
77
op ( )
78
78
this . callHookWithCb ( 'enter' )
79
+ this . cancel = this . hooks && this . hooks . enterCancelled
79
80
queue . push ( this . enterNextTick )
80
81
}
81
82
@@ -104,7 +105,7 @@ p.enterNextTick = function () {
104
105
*/
105
106
106
107
p . enterDone = function ( ) {
107
- this . jsCancel = this . pendingJsCb = null
108
+ this . cancel = this . pendingJsCb = null
108
109
removeClass ( this . el , this . enterClass )
109
110
this . callHook ( 'afterEnter' )
110
111
if ( this . cb ) this . cb ( )
@@ -138,6 +139,7 @@ p.leave = function (op, cb) {
138
139
this . cb = cb
139
140
addClass ( this . el , this . leaveClass )
140
141
this . callHookWithCb ( 'leave' )
142
+ this . cancel = this . hooks && this . hooks . enterCancelled
141
143
// only need to do leaveNextTick if there's no explicit
142
144
// js callback
143
145
if ( ! this . pendingJsCb ) {
@@ -166,6 +168,7 @@ p.leaveNextTick = function () {
166
168
*/
167
169
168
170
p . leaveDone = function ( ) {
171
+ this . cancel = this . pendingJsCb = null
169
172
this . op ( )
170
173
removeClass ( this . el , this . leaveClass )
171
174
this . callHook ( 'afterLeave' )
@@ -194,9 +197,9 @@ p.cancelPending = function () {
194
197
removeClass ( this . el , this . enterClass )
195
198
removeClass ( this . el , this . leaveClass )
196
199
}
197
- if ( this . jsCancel ) {
198
- this . jsCancel . call ( null )
199
- this . jsCancel = null
200
+ if ( this . cancel ) {
201
+ this . cancel . call ( this . vm , this . el )
202
+ this . cancel = null
200
203
}
201
204
}
202
205
@@ -229,7 +232,7 @@ p.callHookWithCb = function (type) {
229
232
if ( hook . length > 1 ) {
230
233
this . pendingJsCb = _ . cancellable ( this [ type + 'Done' ] )
231
234
}
232
- this . jsCancel = hook . call ( this . vm , this . el , this . pendingJsCb )
235
+ hook . call ( this . vm , this . el , this . pendingJsCb )
233
236
}
234
237
}
235
238
0 commit comments