<template>
  <section class="app-main">
    <!--   -->
    <transition name="fade-transform"
                mode="out-in">
      <keep-alive v-if="needKeep">
        <router-view :key="key" />
      </keep-alive>
      <router-view v-else :key="key" />
    </transition>
  </section>
</template>

<script>
import notKeepAliveList from '@/router/notKeepAliveList'
export default {
  name: 'AppMain',
  computed: {
    key () {
      return this.$route.path
    },
    needKeep() {
      return !notKeepAliveList.includes(this.$route.path)
    },
    cachedViews () {
      return this.$store.state.tagsView.cachedViews
    },
    keep () {
      return this.$route.meta.noCache
    }
  }
}
</script>

<style scoped>
.app-main {
  /*50 = navbar  */
  /* height: calc(100vh - 80px); */
  /* height: 100vh; */
  padding-top: 80px;
  /* min-width: 1440px; */
  position: relative;
  /* overflow: auto; */
  box-sizing: border-box;
}
.fixed-header + .app-main {
  padding-top: 80px;
}
</style>

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