<template>
  <section class="app-main">
    <div id="watermark"></div>
    <transition name="fade-transform" mode="out-in">
      <keep-alive :include="cachedViews">
        <router-view v-if="!$route.meta.link" :key="key" />
      </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  */
  // min-height: calc(100vh - 50px);
  display: flex;
  width: 100%;
  height: calc(100% - 1px);
  position: relative;
  // overflow: hidden;
  padding: 8px;
  border-radius: 10px;
  #watermark {
    // display: none;
    width: 700px;
    height: 170px;
    background: url("~@/assets/images/watermark.png") no-repeat center;
    background-size: 100%;
    position: fixed;
    top: 40%;
    left: 27%;
    z-index: 99999;
    transform: rotate(-45deg);
    pointer-events: none;
  }
}

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

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

  .fixed-header + .app-main {
    padding-top: 84px;
  }
}
</style>

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