Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lifecycle hook beforeDestroy is not emitted in Vue3

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>
like image 648
fuminchao Avatar asked Sep 03 '25 03:09

fuminchao


1 Answers

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

like image 60
user2066755 Avatar answered Sep 07 '25 03:09

user2066755