<template>
  <section class="app-main">
    <!-- <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-main {
  height: calc(100vh - 90px);
  // height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
  padding: 0 20px;
  // .el-scrollbar {
  //   // background: #fff;
  // }
}

.fixed-header + .app-main {
  padding-top: 90px;
}

// .hasTagsView {
//   .app-main {
//     height: calc(100vh - 84px);
//   }

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

<style lang="scss">
.el-popup-parent--hidden {
  .fixed-header {
    padding-right: 15px;
  }
}
</style>
<style lang="scss" scoped>
// ::v-deep .el-scrollbar__wrap {
//   overflow-x: hidden !important;
//   height: 100%;
// }
</style>
