Vue: KeepAlive support for switching the same component

Created on 27 Jan 2017  ·  2Comments  ·  Source: vuejs/vue

Maybe there is a reason why this is not supported and perhaps there are better ways of achieving what I need. So I will explain both, what is not working and why I think I need it.

I am working on Vuikit Tabs update to allow preserving the components states. For such I did few tests with keep-alive

Test 1 - keep-alive with different components. Works fine - https://jsfiddle.net/miljan/fcmkwyLr/
Test 2 - keep-alive with same component. Fails - https://jsfiddle.net/miljan/kksp2o4u/

The only different between these two tests is the components being used. I would expect keep-alive to support caching the same component. Is there any reason behind it or is a bug?

Vue.js version

2.1.10

Most helpful comment

Hi, thanks for filing this issue. You can simply key the components and it should work as expected: https://jsfiddle.net/s2x6L3z0/

All 2 comments

Hi, thanks for filing this issue. You can simply key the components and it should work as expected: https://jsfiddle.net/s2x6L3z0/

@fnlctrl, got it working. Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fergaldoyle picture fergaldoyle  ·  3Comments

guan6 picture guan6  ·  3Comments

lmnsg picture lmnsg  ·  3Comments

bdedardel picture bdedardel  ·  3Comments

franciscolourenco picture franciscolourenco  ·  3Comments