1、<router-view ></router-view> 外层包围<keep-alive> </keep-alive>
keep-alive作用将组件实例缓存下来
<keep-alive>
<router-view></router-view>
</keep-alive>
2、清除组件缓存
使用keep-alive 的 exclude="组件名" 属性
<keep-alive exclude="home">
<router-view ></router-view>
</keep-alive>