Skip to content

BaseTransition Unmounting Optimization leads to animation disappear #13316

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

Closed
TalexDreamSoul opened this issue May 12, 2025 · 3 comments
Closed

Comments

@TalexDreamSoul
Copy link

Vue version

3.5.3

Link to minimal reproduction

https://play.vuejs.org/#eNqVV21T2zgQ/ivbdG4SOuQFaG+4HGQKbT/0rtMyB/ep9IOw5VjFtjySHMIx+e+3kiVbsh3aDi+2V6vdZ18kPXoaXZTlbFPR0XJ0pmheZkTRFcBtAXAWsw1EGZHy/HYU8UIRVlBxO7LDqJAerS6JpDeCFJIpxgv4t8h5VShWrOE9zfnZHFUa9a49wTPpmUONu0optPI2ylh0j1qKr9cZvU75A+rdmA94x/OSF7RQZ/Na/TkDVY3nIsvQgAUH+AWT63tWwkXBcqKBH/SMnc0Rrmd6IIYYI5wSQUkYRE/ljm8DDZ2545WXtUuakg3jYon5Og4VfWPEoZ0OVcNOUI3ZqXYOmylLcK6scxgqd+z3cVqlcnWTMgk0oznmfSwho2RDocEDDwxTekdBYlJLGgOKbObP5mXfaSe1tawDPExDZ0b4/ROlwoRJntGwUOnJ6l0thy+VKiul83/ia5SCrp6eIONrOfvOWTEZ394W4wPY7TAuHBtC0L5jTOGKQpGMBCuV+WbYx0LBEwiawA4SwXMY41Ice4Ntk+jlZHVm81Cs16+ZpP/o1kyMaUKqTFs38sgtGrl0IugaN9LdYf2UVFXl5KBV1hlUoNsIzjXiiRIVPQhHdZ7s6NdvzZh7zufwia+BFYqKiJaKCzfCEpiox5LyBDupiNHFi/NzGFcFRoFdHmPGGxzOFxdszQqS2Qpqy+dmCD9mCCTUd8JzmMxmMyLW8gDOV75VqKu8IVlFZ2Ul04nWslWH8YEXDgw4b802ajv32ry4Z1IVkVk37f7mpxqzj5IaCiJ+4X01Gi1Y1Pj67ceu2p0wdLXHUJC2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ytrLRdVxf4zl6C8YLQ6bCZkl7q9F2h7yZg8gHs5o4P139/vLr68B5irDyWzfYJTvdpLJgsYDd6ElvAPrPvRPWZi5xk3r14Yi7GvMgeQVR4TU5pgQe88lx7fgLUVxl51M2RVGgAz6zGZpd1U3XDcsqrgRW0NxH6NMqo8htiKHBskuPFYjHYNO0W+GwnGrVnG3EvZx/t/gcZdcol

Steps to reproduce

  1. Run the application
  2. Click "Toggle Component" to see the component animate out abnormally with a 2-second fade
  3. Click "Unmount All" to see the component immediately disappear without animation

What is expected?

When using "Toggle Component", you'll see the full 2-second leave animation
When using "Unmount All", the animation will be skipped because isUnmounting is set to true by the onBeforeUnmount hook

What is actually happening?

The animatoin dosenot appear

System Info

Any additional comments?

The onBeforeUnmount hook that sets isUnmounting to true
The check in the onLeave method that skips animation when isUnmounting is true

@edison1105
Copy link
Member

you should add v-if on the slot content instead of <transition-demo>
see https://vuejs.org/guide/built-ins/transition.html#reusable-transitions

@TalexDreamSoul
Copy link
Author

you should add v-if on the slot content instead of <transition-demo>
see https://vuejs.org/guide/built-ins/transition.html#reusable-transitions

Sorry. I'm using this on vue-router. I need to play transitions among routes to simulate animations on native mobile.

For example, new route will enter from right side with translateX(120%) to translateX(0%). And leave with reverse of it.

@edison1105
Copy link
Member

Can you provide a minimal demo using vue-router, perhaps we can help you find a suitable solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants