mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 12:07:39 +08:00
add leaveActiveClass
This commit is contained in:
parent
2a7c44f7af
commit
f200e809c0
@ -67,13 +67,20 @@ function onLeave (vnode, rm) {
|
||||
data = detectAuto(data)
|
||||
// apply leave classes
|
||||
const leaveClass = data.leaveClass
|
||||
if (leaveClass) {
|
||||
// do it in next frame to be consistent
|
||||
// with enter transition
|
||||
nextFrame(() => {
|
||||
const leaveActiveClass = data.leaveActiveClass
|
||||
if (leaveClass || leaveActiveClass) {
|
||||
if (leaveClass) {
|
||||
addTransitionClass(el, leaveClass)
|
||||
whenTransitionEnds(el, rm)
|
||||
})
|
||||
nextFrame(() => {
|
||||
removeTransitionClass(el, leaveClass)
|
||||
})
|
||||
}
|
||||
if (leaveActiveClass) {
|
||||
nextFrame(() => {
|
||||
addTransitionClass(el, leaveActiveClass)
|
||||
whenTransitionEnds(el, rm)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
rm()
|
||||
}
|
||||
@ -93,7 +100,8 @@ const autoCssTransition = cached(name => {
|
||||
return {
|
||||
enterClass: `${name}-enter`,
|
||||
leaveClass: `${name}-leave`,
|
||||
enterActiveClass: `${name}-enter-active`
|
||||
enterActiveClass: `${name}-enter-active`,
|
||||
leaveActiveClass: `${name}-leave-active`
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user