Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Transition): should reset enter class when have appear props #1152

Merged
merged 3 commits into from
May 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/runtime-dom/src/components/Transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ export function resolveTransitionProps({
return baseProps
}

const originEnterClass = [enterFromClass, enterActiveClass, enterToClass]
const instance = getCurrentInstance()!
const durations = normalizeDuration(duration)
const enterDuration = durations && durations[0]
const leaveDuration = durations && durations[1]
const { appear, onBeforeEnter, onEnter, onLeave } = baseProps

// is appearing
if (appear && !getCurrentInstance()!.isMounted) {
if (appear && !instance.isMounted) {
enterFromClass = appearFromClass
enterActiveClass = appearActiveClass
enterToClass = appearToClass
Expand All @@ -96,6 +97,10 @@ export function resolveTransitionProps({
removeTransitionClass(el, enterToClass)
removeTransitionClass(el, enterActiveClass)
done && done()
// reset enter class
if (appear) {
;[enterFromClass, enterActiveClass, enterToClass] = originEnterClass
}
}

const finishLeave: Hook = (el, done) => {
Expand Down