Reputation: 15982
Example of my issue here: https://jsfiddle.net/guanzo/myn5o94e/1/
/bar
./bar/barchild
and creates the BarChild
component./foo
Both Foo
and Bar
are "pages". How do i keep BarChild
alive inside Bar
when i switch between pages?
I know why BarChild
disappears, it's because "Go to bar" links to /bar
. But i don't know how to implement my desired behavior.
Upvotes: 1
Views: 1939
Reputation: 13858
Looks like you want the app to remember last visited child route of /bar
. This is not what keep-alive
was supposed to do.
I suggest you to introduce a centralized store to save the data you want to remember and retrieve later. It could be as easy as another new Vue
instance, or vuex for more complicated product. You could read this page from official docs for more details.
Upvotes: 3