Under what circumstances will vue execute the destruction hook in the life cycle?
光阴似箭催人老,日月如移越少年。
When the component is destroyed
<demo v-if="hasDemo"></demo>
Then when hasDemo is changed from true to false, the destruction hook of the Demo component will be triggered.
hasDemo
Note that the v-show command does not destroy the element but only hides it, so this hook will not be triggered.
When the component is destroyed
Then when
hasDemo
is changed from true to false, the destruction hook of the Demo component will be triggered.Note that the v-show command does not destroy the element but only hides it, so this hook will not be triggered.