Browse Source

ensure enter and leave transitions happen simultaneously

dev
Evan You 9 years ago
parent
commit
2a7c44f7af
  1. 9
      src/runtime/dom-backend/modules/transition.js

9
src/runtime/dom-backend/modules/transition.js

@ -56,7 +56,6 @@ function beforeEnter (_, vnode) {
}
function onLeave (vnode, rm) {
console.log(vnode)
const el = vnode.elm
if (!el) return
// call enter callback now
@ -69,8 +68,12 @@ function onLeave (vnode, rm) {
// apply leave classes
const leaveClass = data.leaveClass
if (leaveClass) {
addTransitionClass(el, leaveClass)
whenTransitionEnds(el, rm)
// do it in next frame to be consistent
// with enter transition
nextFrame(() => {
addTransitionClass(el, leaveClass)
whenTransitionEnds(el, rm)
})
} else {
rm()
}

Loading…
Cancel
Save