<template>
  <section
    :class="
      $route.path.substr($route.path.length - 10) === '/dashboard'
        ? 'app-main2'
        : 'app-main1'
    "
  >
    <transition name="fade-transform" mode="out-in">
      <keep-alive :include="cachedViews">
        <router-view
          :key="key"
          ref="main"
          style="height: 100%; overflow-y: auto"
        />
      </keep-alive>
    </transition>
  </section>
</template>

<script>
export default {
  name: "AppMain",
  computed: {
    cachedViews() {
      return this.$store.state.tagsView.cachedViews;
    },
    key() {
      return this.$route.path;
    }
  },
  methods: {}
};
</script>

<style lang="scss" scoped>
.app-main1 {
  height: calc(100vh - 125px);
  width: 100%;
  position: relative;
  overflow: hidden;
  padding: 0 20px;
}

.app-main2 {
  height: calc(100vh - 85px);
  width: 100%;
  position: relative;
  overflow: hidden;
  padding: 0 20px;
}
</style>
