Skip to content

Commit

Permalink
fix(compat): fix custom transition classes in compat mode (#7435)
Browse files Browse the repository at this point in the history
fix #6253
  • Loading branch information
SxDx authored Feb 1, 2023
1 parent e64c9ae commit efe2efd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/runtime-dom/src/components/Transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,12 @@ export function resolveTransitionProps(
nextFrame(() => {
removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass)
if (__COMPAT__ && legacyClassEnabled) {
removeTransitionClass(
el,
isAppear ? legacyAppearFromClass : legacyEnterFromClass
)
const legacyClass = isAppear
? legacyAppearFromClass
: legacyEnterFromClass
if (legacyClass) {
removeTransitionClass(el, legacyClass)
}
}
addTransitionClass(el, isAppear ? appearToClass : enterToClass)
if (!hasExplicitCallback(hook)) {
Expand All @@ -212,15 +214,15 @@ export function resolveTransitionProps(
onBeforeEnter(el) {
callHook(onBeforeEnter, [el])
addTransitionClass(el, enterFromClass)
if (__COMPAT__ && legacyClassEnabled) {
if (__COMPAT__ && legacyClassEnabled && legacyEnterFromClass) {
addTransitionClass(el, legacyEnterFromClass)
}
addTransitionClass(el, enterActiveClass)
},
onBeforeAppear(el) {
callHook(onBeforeAppear, [el])
addTransitionClass(el, appearFromClass)
if (__COMPAT__ && legacyClassEnabled) {
if (__COMPAT__ && legacyClassEnabled && legacyAppearFromClass) {
addTransitionClass(el, legacyAppearFromClass)
}
addTransitionClass(el, appearActiveClass)
Expand All @@ -231,7 +233,7 @@ export function resolveTransitionProps(
el._isLeaving = true
const resolve = () => finishLeave(el, done)
addTransitionClass(el, leaveFromClass)
if (__COMPAT__ && legacyClassEnabled) {
if (__COMPAT__ && legacyClassEnabled && legacyLeaveFromClass) {
addTransitionClass(el, legacyLeaveFromClass)
}
// force reflow so *-leave-from classes immediately take effect (#2593)
Expand All @@ -243,7 +245,7 @@ export function resolveTransitionProps(
return
}
removeTransitionClass(el, leaveFromClass)
if (__COMPAT__ && legacyClassEnabled) {
if (__COMPAT__ && legacyClassEnabled && legacyLeaveFromClass) {
removeTransitionClass(el, legacyLeaveFromClass)
}
addTransitionClass(el, leaveToClass)
Expand Down

0 comments on commit efe2efd

Please sign in to comment.