找到主布局 admin.vue
在router-view中这样修改
<router-view v-slot="{ Component }">
// 开了10个后 最久没被使用的销毁掉
<keep-alive :max="10">
<component :is="Component"></component>
</keep-alive>
</router-view>