vue 缓存界面

1.配置路由
meta: {
 keepAlive: true
}
 
2.配置App.vue
<keep-alive>
  <router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive"></router-view>
 
3.加载时执行
activated() {}
 
4.后台时执行
deactivated() {}
 
posted @ 2020-06-16 13:48  动听小林  阅读(115)  评论(0编辑  收藏  举报