<template>
  <section class="app-main">
    <transition name="fade-transform" mode="out-in">
      <!-- <keep-alive> -->
      <keep-alive :include="cachedViews">
        <router-view v-if="!$route.meta.link" style="height: 100%" />
      </keep-alive>
    </transition>
    <iframe-toggle />
  </section>
</template>

<script>
import iframeToggle from "./IframeToggle/index";

export default {
  name: "AppMain",
  components: { iframeToggle },
  computed: {
    cachedViews() {
      return this.$store.state.tagsView.cachedViews;
    },
    key() {
      return this.$route.path;
    },
  },
};
</script>

<style lang="scss" scoped>
.app-main {
  /* 50= navbar  50  */
  // padding-top: 104px;
  // min-height: calc(100vh - 50px);
  height: calc(100% - 45px);
  // overflow: auto;
  // width: calc(100% - 20px);
  // margin:0 10px;
  position: relative;
  border-radius: 4px;
  top: 0px;
}

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

.hasTagsView {
  .app-main {
    /* 84 = navbar + tags-view = 50 + 34 */
    min-height: calc(100vh - 84px);
    height: 100%;
    background-color: #fafafa;
  }

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

// .el-dialog__wrapper{
//     position: absolute !important;
//   }
// .v-modal{
//     position: absolute !important;
//   }
</style>

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