Skip to content

feat: add new lifecycle onAfterUnmount #8762

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

Conversation

Alfred-Skyblue
Copy link
Member

@Alfred-Skyblue Alfred-Skyblue commented Jul 11, 2023

RFC: vuejs/rfcs#510

When we remove an element in JavaScript, the components contained within that element do not execute the onUnmounted lifecycle. I added a new lifecycle called onAfterUnmounted, which triggers after the component's el or the element containing the current component is removed from the DOM tree. Internally, I use a MutationObserver to listen for its removal.

demo

@Alfred-Skyblue Alfred-Skyblue marked this pull request as draft July 11, 2023 16:11
@Alfred-Skyblue Alfred-Skyblue deleted the feat-onAfterUnMounted branch July 13, 2023 09:29
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

Successfully merging this pull request may close these issues.

1 participant