Vue中缓存路由

1. 作用: 让不展示的路由组件保持挂载,不被销毁.

2. 具体代码

2.1 缓存展示区所有组件

<keep-alive>
	<router-view><router-view>
</keep-alive>

2.2 缓存一个组件

<keep-alive include='组件名'>
	<router-view><router-view>
</keep-alive>

2.3 缓存多个组件

<keep-alive :include="['组件名1','组件名2']">
	<router-view><router-view>
</keep-alive>