@@ -9,11 +9,12 @@ import {
9
9
transitionEndEvent ,
10
10
animationEndEvent ,
11
11
transitionProp ,
12
- animationProp
12
+ animationProp ,
13
+ warn
13
14
} from '../util/index'
14
15
15
- const TYPE_TRANSITION = 1
16
- const TYPE_ANIMATION = 2
16
+ const TYPE_TRANSITION = 'transition'
17
+ const TYPE_ANIMATION = 'animation'
17
18
const transDurationProp = transitionProp + 'Duration'
18
19
const animDurationProp = animationProp + 'Duration'
19
20
@@ -44,6 +45,21 @@ export default function Transition (el, id, hooks, vm) {
44
45
this . justEntered = false
45
46
this . entered = this . left = false
46
47
this . typeCache = { }
48
+ // check css transition type
49
+ this . type = hooks && hooks . type
50
+ /* istanbul ignore if */
51
+ if ( process . env . NODE_ENV !== 'production' ) {
52
+ if (
53
+ this . type &&
54
+ this . type !== TYPE_TRANSITION &&
55
+ this . type !== TYPE_ANIMATION
56
+ ) {
57
+ warn (
58
+ 'invalid CSS transition type for transition="' +
59
+ this . id + '": ' + this . type
60
+ )
61
+ }
62
+ }
47
63
// bind
48
64
var self = this
49
65
; [ 'enterNextTick' , 'enterDone' , 'leaveNextTick' , 'leaveDone' ]
@@ -309,7 +325,7 @@ p.getCssTransitionType = function (className) {
309
325
) {
310
326
return
311
327
}
312
- var type = this . typeCache [ className ]
328
+ var type = this . type || this . typeCache [ className ]
313
329
if ( type ) return type
314
330
var inlineStyles = this . el . style
315
331
var computedStyles = window . getComputedStyle ( this . el )
0 commit comments