Skip to content

Commit cf7b90f

Browse files
committed
fix flow
1 parent 10e724f commit cf7b90f

File tree

1 file changed

+35
-10
lines changed

1 file changed

+35
-10
lines changed

src/platforms/web/runtime/modules/transition.js

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { once, isObject, toNumber } from 'shared/util'
44
import { inBrowser, isIE9, warn } from 'core/util/index'
55
import { mergeVNodeHook } from 'core/vdom/helpers/index'
66
import { activeInstance } from 'core/instance/lifecycle'
7+
78
import {
89
nextFrame,
910
resolveTransition,
@@ -68,16 +69,35 @@ export function enter (vnode: VNodeWithData, toggleDisplay: ?() => void) {
6869
return
6970
}
7071

71-
const startClass = isAppear && appearClass ? appearClass : enterClass
72-
const activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass
73-
const toClass = isAppear && appearToClass ? appearToClass : enterToClass
74-
75-
const beforeEnterHook = isAppear ? (beforeAppear || beforeEnter) : beforeEnter
76-
const enterHook = isAppear ? (typeof appear === 'function' ? appear : enter) : enter
77-
const afterEnterHook = isAppear ? (afterAppear || afterEnter) : afterEnter
78-
const enterCancelledHook = isAppear ? (appearCancelled || enterCancelled) : enterCancelled
72+
const startClass = isAppear && appearClass
73+
? appearClass
74+
: enterClass
75+
const activeClass = isAppear && appearActiveClass
76+
? appearActiveClass
77+
: enterActiveClass
78+
const toClass = isAppear && appearToClass
79+
? appearToClass
80+
: enterToClass
81+
82+
const beforeEnterHook = isAppear
83+
? (beforeAppear || beforeEnter)
84+
: beforeEnter
85+
const enterHook = isAppear
86+
? (typeof appear === 'function' ? appear : enter)
87+
: enter
88+
const afterEnterHook = isAppear
89+
? (afterAppear || afterEnter)
90+
: afterEnter
91+
const enterCancelledHook = isAppear
92+
? (appearCancelled || enterCancelled)
93+
: enterCancelled
94+
95+
const explicitEnterDuration: any = toNumber(
96+
isObject(duration)
97+
? duration.enter
98+
: duration
99+
)
79100

80-
const explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration)
81101
if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
82102
checkDuration(explicitEnterDuration, 'enter', vnode)
83103
}
@@ -179,7 +199,12 @@ export function leave (vnode: VNodeWithData, rm: Function) {
179199
const expectsCSS = css !== false && !isIE9
180200
const userWantsControl = getHookAgumentsLength(leave)
181201

182-
const explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration)
202+
const explicitLeaveDuration: any = toNumber(
203+
isObject(duration)
204+
? duration.leave
205+
: duration
206+
)
207+
183208
if (process.env.NODE_ENV !== 'production' && explicitLeaveDuration != null) {
184209
checkDuration(explicitLeaveDuration, 'leave', vnode)
185210
}

0 commit comments

Comments
 (0)