Skip to content

Commit a4d63a1

Browse files
committed
adjust transition-group pending move callback execution timing
1 parent bd58337 commit a4d63a1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: src/platforms/web/runtime/components/transition-group.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,11 @@ export default {
9494
}
9595

9696
children.forEach(c => {
97+
if (c.elm._moveCb) {
98+
c.elm._moveCb()
99+
}
97100
const oldPos = c.data.pos
98-
const newPos = c.elm.getBoundingClientRect()
101+
const newPos = c.data.pos = c.elm.getBoundingClientRect()
99102
const dx = oldPos.left - newPos.left
100103
const dy = oldPos.top - newPos.top
101104
if (dx || dy) {
@@ -112,16 +115,13 @@ export default {
112115
children.forEach(c => {
113116
if (c.data.moved) {
114117
const el = c.elm
115-
/* istanbul ignore if */
116-
if (el._pendingMoveCb) {
117-
el._pendingMoveCb()
118-
}
119118
const s = el.style
120119
addTransitionClass(el, moveClass)
121120
s.transform = s.WebkitTransform = s.transitionDuration = ''
122-
el.addEventListener(transitionEndEvent, el._pendingMoveCb = function cb () {
121+
el._moveDest = c.data.pos
122+
el.addEventListener(transitionEndEvent, el._moveCb = function cb () {
123123
el.removeEventListener(transitionEndEvent, cb)
124-
el._pendingMoveCb = null
124+
el._moveCb = null
125125
removeTransitionClass(el, moveClass)
126126
})
127127
}

0 commit comments

Comments
 (0)