In my vue app some particular components inrouter-view
are cached by using <keep-alive></keep-alive>
that vue provides.
When a user logs in the posts.vue component is cached as I said above
Everything works fine.
Now I want to destroy this posts.vue component when the user logs out.So that posts.vue
component re-renders when the user logs in again
The log out button is present in completely other component menu.vue
and the on click logic for log out is present in this nenu.vue
component
So how could I implement this using vm.$destroy()
method from menu.vue
component on posts.vue
component
so my main problem is how to control lifecycle of one component from the other
the docs warn using this as follows :,
In normal use cases you shouldn’t have to call this method yourself.
Prefer controlling the lifecycle of child components in a data-driven fashion using v-if
and v-for
.
but in my case I cant use v-if
or v-show
or is there any better way i could use