<template>
  <section class="app-main">
    <div :class="contentClass" class="app-main-content">
      <!-- <transition name="fade-transform" mode="out-in">
        <router-view :key="key" />
      </transition> -->
      <transition name="fade-transform" mode="out-in">
        <keep-alive v-if="$route.meta.keepAlive">
          <router-view :key="key"></router-view>
        </keep-alive>
        <router-view v-else :key="key"></router-view>
      </transition>
    </div>
  </section>
</template>

<script>
export default {
  name: "AppMain",
  computed: {
    key() {
      return this.$route.path;
    },
    contentClass() {
      return {
        "app-content-setWidth": this.$store.state.user.isFixedWidth,
      };
    },
  },
};
</script>

<style lang="scss" scoped>
.app-main {
  position: relative;
  // width: 100%;
  // min-height: calc(100% - 85px);
  margin: 0 20px 20px;
  .app-main-content {
    background-color: #fff;
    border-radius: 5px;
    overflow: hidden;
    > div {
      padding: 20px;
      background-color: #fff;
    }
  }
}
</style>

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