<template>
  <section
    :class="
      $route.path.substr($route.path.length - 10) === '/dashboard'
        ? 'app-main2'
        : 'app-main1'
    "
  >
    <!-- <el-scrollbar
      style="height: 100%"  
    > -->
    <transition
      name="fade-transform"
      mode="out-in"
      v-if="$route.path.substr($route.path.length - 10) !== '/dashboard'"
    >
      <keep-alive :include="cachedViews">
        <router-view :key="key" ref="main" style="height: 100%" />
      </keep-alive>
    </transition>
    <!-- </el-scrollbar> -->
    <transition
      name="fade-transform"
      mode="out-in"
      v-else-if="$route.path.substr($route.path.length - 10) === '/dashboard'"
    >
      <keep-alive :include="cachedViews">
        <router-view :key="key" ref="main" />
      </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 - 90px);
  width: 100%;
  position: relative;
  overflow: hidden;
  padding: 0 20px;
}

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

.fixed-header + .app-main {
  padding-top: 90px;
}
</style>

<style lang="scss">
.el-popup-parent--hidden {
  .fixed-header {
    padding-right: 15px;
  }
}
</style>
