<template>
  <div class="home">
    <nav-menu></nav-menu>
    <div class="right">
      <home-header />
      <div class="content">
        <keep-alive :include="cacheView">
          <router-view :key="$route.name" />
        </keep-alive>
      </div>
    </div>
  </div>
</template>

<script>
import NavMenu from './navMenu.vue'
import HomeHeader from './HomeHeader.vue'
import { mapState } from 'vuex'

// @ is an alias to /src
export default {
  name: 'HomeView',
  components: {
    NavMenu,
    HomeHeader,
  },
  computed: {
    ...mapState('tags', ['tags']),
    cacheView() {
      const arr = []
      return arr.concat(this.tags.map((item) => item.name))
    },
  },
  data() {
    return {}
  },
}
</script>
<style lang="scss" scoped>
.home {
  height: 100%;
  overflow: hidden;
}

.right {
  height: calc(100% - 60px);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.home-header {
  height: 50px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  z-index: 100;
}

.content {
  flex: 1;
  padding: 10px;
  background-color: #f1f1f1;
}
</style>
