-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
feat(keep-alive): includes/excludes keep-alive based on key and name (fix #8028) #10245
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
base: dev
Are you sure you want to change the base?
Conversation
The keep-alive component will now also use the key of the component when checking the includes or excludes properties. fix vuejs#8028
How to use it?Any example?I try it, but faild. |
I've made a JSFiddle: https://jsfiddle.net/87t53pwd/18/. A small explanation: In the keep-alive block we have 3 usages of the same component with each a different state. We only want to keep the state cached of the first 2, and not the last. The current version of keep-alive doesn't allow for this (because it only uses the name of the component, not the key). Now, it also looks at the key (so if either the name or the key matches something in the includes array, it caches it). You can replace the newly built version of Vue by the old one and see the difference (it works vs it doesn't) |
Thank you for your answer. |
Yes, because this pull request has not been merged yet. If you try dev on my fork it should work |
I have urgent need for this function in my project. When will it be merged? Or I can use RobbinBaauw:dev branch? |
I can't merge it, the vue authors need to do that. You can use that branch if you want, you'll see here when / if it will be merged |
OK. Thank you so much. |
I try to install git://github.com/RobbinBaauw/vue.git#dev, but it seems not work with vue-router |
Can you make a fiddle? In the project I use it for it works, also with vue-router. Also, how did you use it? You should build vue manually as well as its dist files are not yet updated. |
Sorry, it is my mistake.It works now.Thank you . |
The keep-alive component will now also use the key of the component when checking the includes or excludes properties.
On this way you can cache specific instances of a component instead of caching all instances of that component.
fix #8028
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
The PR fulfills these requirements:
dev
branch for v2.x (or to a previous version branch), not themaster
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)