<template>
  <router-view v-slot="{ Component, route }">
    <keep-alive :include="cacheList">
      <component :is="Component" :key="route.name" />
    </keep-alive>
  </router-view>
</template>

<script>
export default {
  name: 'App',
  computed: {
    cacheList() {
      const routes = this.$router.getRoutes()
      return routes.filter(r => r.meta.cache).map(r => r.name)
    }
  }
}
</script>