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匹配到了匿名组件 #6935

Closed
lf541512 opened this issue Oct 27, 2017 · 3 comments
Closed

keep-alive匹配到了匿名组件 #6935

lf541512 opened this issue Oct 27, 2017 · 3 comments

Comments

@lf541512
Copy link

lf541512 commented Oct 27, 2017

Version

2.5.2

Reproduction link

https://github.com/lf541512/vue-keep-alive-test

Steps to reproduce

1.用keep-alive包装router-view
<keep-alive include="home"> <router-view></router-view> </keep-alive>

2.新建Home和Count两个组件,其中Count不指定name,为组件添加created 和activated生命周期函数

3.添加路由路径和跳转链接

What is expected?

按照文档中对keep-alive的匹配规则描述,对匿名组件是不会缓存的
每次重新进入Count组件时,都会调用其created 函数

What is actually happening?

从console输出可以看到,重新进入Count组件时,调用了其activated而不是created ,可见是缓存了这个匿名组件,当给Count指定一个name时,就不会匹配上缓存这个组件。
这是feature还是bug?或者是我的用法不对?

@svdongen
Copy link

Could you translate in English?

@lf541512
Copy link
Author

somebody translate this in English at #6938

@LinusBorg
Copy link
Member

Then we close this in favour of #6938

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