Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep-alive can not cache two router-view #2523

Closed
spencer17x opened this issue Dec 7, 2018 · 3 comments
Closed

keep-alive can not cache two router-view #2523

spencer17x opened this issue Dec 7, 2018 · 3 comments

Comments

@spencer17x
Copy link

Version

2.5.1

Reproduction link

https://github.com/xuzpeng/vue-sell.git

Steps to reproduce

The order page and home page switch pages are not cached, or the home page -> find page -> order page -> home page still occurs.

What is expected?

Order page and home page are cached

What is actually happening?

not cached

@LinusBorg
Copy link
Member

Without having run the reproduction, it seems like you should set a key.

<keep-alive>
  <router-view v-if="$route.meta.keepAlive" key="A"/>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive" :key="B"/>

@spencer17x
Copy link
Author

@LinusBorg I have tried it, but it has the same question.

@posva
Copy link
Member

posva commented Dec 7, 2018

Please boil down the repro to the minimal when reporting a bug, this is your whole project. You can use codesandbox or jsfiddle.net to easily share something

@posva posva closed this as completed Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants