vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.97k stars 33.68k forks source link

keep-alive include parameter is not worked with router-view #6619

Closed okjesse closed 7 years ago

okjesse commented 7 years ago

Version

2.4.4

Reproduction link

https://jsfiddle.net/okjesse/k94fphsg/

Steps to reproduce

keep-alive include parameter is not worked with router-view

What is expected?

Home is not keep alived

What is actually happening?

home is keep alived

yyx990803 commented 7 years ago

keep-alive include works on component names, not route names. Your Foo component doesn't have a name.

sqal commented 7 years ago

It happens because you have not given Home component a name

https://jsfiddle.net/b9xk5rdw/

okjesse commented 7 years ago

@sqal thank you,it's woks

dkjain commented 6 years ago

Hi sqal,

In both the problem fiddle & your solution fiddle, both components have names, const Home = { name: 'Home', const Foo = { name: 'Foo'

so not sure when you say

It happens because you have not given Home component a name

Kindly clarify.

thanks