18

I use vue3 beta 18, found that beforeDestroy is not emitted when I remove a component which is rendered by dynamic component in v-for.

Neither are deactivated, destroyed.

The component is "disappeared", when I remove it from the collection "windows".

<template>
component(v-for="ww in windows" :key="ww.$id" :is="ww.component" v-bind="ww.props")
</template>
fuminchao
  • 181
  • 1
  • 1
  • 5
  • Find an explanation of vue3 lifecycle hooks in depth at [Vue 3 lifecycle hooks with real-time example](https://blog.canopas.com/vue-3-lifecycle-hooks-with-real-time-example-1b772b89e085) – nidhi_007 Mar 26 '22 at 05:50

1 Answers1

30

In Vue 3 beforeDestroy and destroyed hooks are replaced with beforeUnmount and unmounted https://v3.vuejs.org/api/options-lifecycle-hooks.html#beforeunmount

user2066755
  • 323
  • 3
  • 9