<template>
  <div class="app-main">
    <el-scrollbar wrap-class="scrollBar">
      <div class="inner">
        <transition
          name="fade"
          mode="out-in">
          <keep-alive :include="cachedViews">
            <router-view :key="key"/>
          </keep-alive>
        </transition>
      </div>
    </el-scrollbar>
  </div>
</template>

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

<style lang="scss">
.app-main {
  // box-shadow: 0 0 10px #ddd;border-radius: 10px;
  position: absolute;
  top: 84px;
  right: 0;
  bottom: 0;
  left: 0;
  overflow-x: hidden !important;
  background-color: #f8f9fd;

  .el-scrollbar {
    height: 100%;
  }

  .scrollBar {
    overflow-x: hidden !important;

    .el-scrollbar__view {
      height: calc(100% - 40px);
      padding: 20px;
    }
  }
}

</style>
