keep-alive
用于保存组件的渲染状态(include、exclude)
include表示只有Name的属性会被缓存,其他不会
exclude表示Name的属性不会保存缓存。
普通路由
<keep-alive exclude="B">
<router-view></router-view>
</keep-alive>
动态组件
<keep-alive :include="whiteList" :exclude="blackList">
<component :is="currentComponent"></component>
</keep-alive>
在组件生命周期destroyed函数打印,可看出缓存销毁记录

3万+

被折叠的 条评论
为什么被折叠?



