<template>
  <section class="app-main" :class="!sidebar.opened ? 'openSider' : ''">
    <transition name="fade-transform" mode="out-in">
      <keep-alive :include="cachedData">
        <!-- <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";
import { mapGetters } from "vuex";
export default {
  name: "AppMain",
  components: { iframeToggle },
  data() {
    return {
      cachedData: ["ApiAdmin", "scenneAdmin","listOfApps"],
    };
  },
  computed: {
    ...mapGetters(["sidebar"]),
    cachedViews() {
      return this.$store.state.tagsView.cachedViews;
    },
    key() {
      return this.$route.path;
    },
  },
};
</script>

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

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

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

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

// .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>
