@@ -29,7 +29,7 @@ function Transition (el, id, hooks, vm) {
2929 // async state
3030 this . pendingCssEvent =
3131 this . pendingCssCb =
32- this . jsCancel =
32+ this . cancel =
3333 this . pendingJsCb =
3434 this . op =
3535 this . cb = null
@@ -76,6 +76,7 @@ p.enter = function (op, cb) {
7676 addClass ( this . el , this . enterClass )
7777 op ( )
7878 this . callHookWithCb ( 'enter' )
79+ this . cancel = this . hooks && this . hooks . enterCancelled
7980 queue . push ( this . enterNextTick )
8081}
8182
@@ -104,7 +105,7 @@ p.enterNextTick = function () {
104105 */
105106
106107p . enterDone = function ( ) {
107- this . jsCancel = this . pendingJsCb = null
108+ this . cancel = this . pendingJsCb = null
108109 removeClass ( this . el , this . enterClass )
109110 this . callHook ( 'afterEnter' )
110111 if ( this . cb ) this . cb ( )
@@ -138,6 +139,7 @@ p.leave = function (op, cb) {
138139 this . cb = cb
139140 addClass ( this . el , this . leaveClass )
140141 this . callHookWithCb ( 'leave' )
142+ this . cancel = this . hooks && this . hooks . enterCancelled
141143 // only need to do leaveNextTick if there's no explicit
142144 // js callback
143145 if ( ! this . pendingJsCb ) {
@@ -166,6 +168,7 @@ p.leaveNextTick = function () {
166168 */
167169
168170p . leaveDone = function ( ) {
171+ this . cancel = this . pendingJsCb = null
169172 this . op ( )
170173 removeClass ( this . el , this . leaveClass )
171174 this . callHook ( 'afterLeave' )
@@ -194,9 +197,9 @@ p.cancelPending = function () {
194197 removeClass ( this . el , this . enterClass )
195198 removeClass ( this . el , this . leaveClass )
196199 }
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
200203 }
201204}
202205
@@ -229,7 +232,7 @@ p.callHookWithCb = function (type) {
229232 if ( hook . length > 1 ) {
230233 this . pendingJsCb = _ . cancellable ( this [ type + 'Done' ] )
231234 }
232- this . jsCancel = hook . call ( this . vm , this . el , this . pendingJsCb )
235+ hook . call ( this . vm , this . el , this . pendingJsCb )
233236 }
234237}
235238
0 commit comments